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