more msftidy checks

This commit is contained in:
Christian Mehlmauer 2014-12-11 23:10:07 +01:00
parent 47c38ed04e
commit be1440bcb9
No known key found for this signature in database
GPG Key ID: BCFF4FA966BC32C7
1 changed files with 15 additions and 1 deletions

View File

@ -536,7 +536,7 @@ class Msftidy
# RM#8498 for discussion, starting at comment #16:
#
# https://dev.metasploit.com/redmine/issues/8498#note-16
if ln =~ /(?<!\.)datastore\[["'][^"']+["']\]\s*=(?![=~>])/
if ln =~ /(?<!\.)datastore\[["'][^"']+["']\]\s*(=|<<)(?![=~>])/
info("datastore is modified in code: #{ln}", idx)
end
@ -549,6 +549,10 @@ class Msftidy
if ln =~ /^\s*Rank\s*=\s*/ and @source =~ /<\sMsf::Auxiliary/
warn("Auxiliary modules have no 'Rank': #{ln}", idx)
end
if ln =~ /^\s*def\s+(?:[^\(\)]*[A-Z]+[^\(\)]*)(?:\(.*\))?$/
warn("Please use snake case on method names: #{ln}", idx)
end
end
end
@ -586,6 +590,15 @@ class Msftidy
end
end
def check_invalid_url_scheme
test = @source.scan(/^.+http\/\/.+$/)
unless test.empty?
test.each { |item|
info("Invalid URL: #{item}")
}
end
end
private
def load_file(file)
@ -634,6 +647,7 @@ def run_checks(full_filepath)
tidy.check_newline_eof
tidy.check_sock_get
tidy.check_udp_sock_get
tidy.check_invalid_url_scheme
return tidy
end