Skip to content

Commit

Permalink
Land #13188 new msftidy_docs
Browse files Browse the repository at this point in the history
Land #13188 new msftidy_docs. Change Options from bold to h3 instead.
  • Loading branch information
tperry-r7 committed Apr 6, 2020
2 parents 574f6af + f3ebd26 commit 62dd03c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tools/dev/msftidy_docs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ def h2_order
def line_checks
idx = 0
in_codeblock = false
in_options = false

@lines.each do |ln|
idx += 1
Expand All @@ -218,6 +219,23 @@ def line_checks
in_codeblock = !in_codeblock
end

if ln =~ /## Options/
in_options = true
end

if ln =~ /## Scenarios/ || (in_options && ln =~ /$\s*## /) # we're not in options anymore
# we set a hard false here because there isn't a guarantee options exists
in_options = false
end

if in_options && ln =~ /^\s*\*\*[a-z]+\*\*$/i # catch options in old format like **command** instead of ### comand
warn("Options should use ### instead of bolds (**)", idx)
end

# this will catch either bold or h2/3 universal options. Defaults aren't needed since they're not unique to this exploit
if in_options && ln =~ /^\s*[\*#]{2,3}\s*(rhost|rhosts|rport|lport|lhost|srvhost|srvport|ssl|uripath|session|proxies|payload)\*{0,2}$/i
warn('Universal options such as rhost(s), rport, lport, lhost, srvhost, srvport, ssl, uripath, session, proxies, payload can be removed.', idx)
end
# find spaces at EOL not in a code block which is ``` or starts with four spaces
if !in_codeblock && ln =~ /[ \t]$/ && !(ln =~ /^ /)
warn("Spaces at EOL", idx)
Expand Down

0 comments on commit 62dd03c

Please sign in to comment.