From be1440bcb94c32c68ec26b8f11c5f745df3149b2 Mon Sep 17 00:00:00 2001 From: Christian Mehlmauer Date: Thu, 11 Dec 2014 23:10:07 +0100 Subject: [PATCH] more msftidy checks --- tools/msftidy.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tools/msftidy.rb b/tools/msftidy.rb index 2759585f06..f0052f7c6d 100755 --- a/tools/msftidy.rb +++ b/tools/msftidy.rb @@ -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 =~ /(?])/ + if ln =~ /(?])/ 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