Skip to content

Commit be1440b

Browse files
committed
more msftidy checks
1 parent 47c38ed commit be1440b

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tools/msftidy.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ def check_lines
536536
# RM#8498 for discussion, starting at comment #16:
537537
#
538538
# https://dev.metasploit.com/redmine/issues/8498#note-16
539-
if ln =~ /(?<!\.)datastore\[["'][^"']+["']\]\s*=(?![=~>])/
539+
if ln =~ /(?<!\.)datastore\[["'][^"']+["']\]\s*(=|<<)(?![=~>])/
540540
info("datastore is modified in code: #{ln}", idx)
541541
end
542542

@@ -549,6 +549,10 @@ def check_lines
549549
if ln =~ /^\s*Rank\s*=\s*/ and @source =~ /<\sMsf::Auxiliary/
550550
warn("Auxiliary modules have no 'Rank': #{ln}", idx)
551551
end
552+
553+
if ln =~ /^\s*def\s+(?:[^\(\)]*[A-Z]+[^\(\)]*)(?:\(.*\))?$/
554+
warn("Please use snake case on method names: #{ln}", idx)
555+
end
552556
end
553557
end
554558

@@ -586,6 +590,15 @@ def check_udp_sock_get
586590
end
587591
end
588592

593+
def check_invalid_url_scheme
594+
test = @source.scan(/^.+http\/\/.+$/)
595+
unless test.empty?
596+
test.each { |item|
597+
info("Invalid URL: #{item}")
598+
}
599+
end
600+
end
601+
589602
private
590603

591604
def load_file(file)
@@ -634,6 +647,7 @@ def run_checks(full_filepath)
634647
tidy.check_newline_eof
635648
tidy.check_sock_get
636649
tidy.check_udp_sock_get
650+
tidy.check_invalid_url_scheme
637651
return tidy
638652
end
639653

0 commit comments

Comments
 (0)