Skip to content

Commit 1092489

Browse files
author
jvazquez-r7
committed
Merge branch 'title_casing' of https://github.com/wchen-r7/metasploit-framework into wchen-r7-title_casing
2 parents f81ef9b + ab26995 commit 1092489

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

tools/msftidy.rb

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,14 @@ def check_disclosure_date
208208
end
209209
end
210210

211-
def check_title_format
212-
if @source =~ /'Name'\s+=>\s[\x22\x27](.+)[\x22\x27],\s*$/
213-
name = $1
211+
def check_title_casing
212+
if @source =~ /'Name'[[:space:]]*=>[[:space:]]*['|"](.+)['|"],*$/
214213
words = $1.split
215-
[words.first, words.last].each do |word|
216-
if word[0,1] =~ /[a-z]/ and word[1,1] !~ /[A-Z0-9]/
217-
next if word =~ /php[A-Z]/
218-
next if %w{iseemedia activePDF freeFTPd osCommerce myBB qdPM inetd wallet.dat}.include? word
219-
warn("Improper capitalization in module title: '#{word}...'")
214+
words.each do |word|
215+
if %w{and or the for to in of as with a an}.include?(word)
216+
next
217+
elsif word =~ /^[a-z]+$/
218+
warn("Improper capitalization in module title: '#{word}'")
220219
end
221220
end
222221
end
@@ -329,7 +328,7 @@ def run_checks(f_rel)
329328
tidy.test_old_rubies(f_rel)
330329
tidy.check_ranking
331330
tidy.check_disclosure_date
332-
tidy.check_title_format
331+
tidy.check_title_casing
333332
tidy.check_bad_terms
334333
tidy.check_function_basics
335334
tidy.check_lines

0 commit comments

Comments
 (0)