Skip to content

Commit ee1aaac

Browse files
committed
Look for SVN keywords that no longer use.
1 parent d2fccf9 commit ee1aaac

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tools/msftidy.rb

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,34 @@ def error(txt, line=0)
5959
#
6060
##
6161

62+
def check_old_keywords
63+
max_count = 10
64+
counter = 0
65+
if @source =~ /^##/
66+
first_line = true
67+
@source.each_line do |line|
68+
# If exists, the $Id$ keyword should appear at the top of the code.
69+
# If not (within the first 10 lines), then we assume there's no
70+
# $Id$, and then bail.
71+
break if counter >= max_count
72+
73+
if line =~ /^#[[:space:]]*\$Id\$/i
74+
warn("Keyword $Id$ is no longer needed.")
75+
break
76+
end
77+
78+
return if !first_line and line =~ /^##/
79+
first_line = false
80+
81+
counter += 1
82+
end
83+
end
84+
85+
if @source =~ /'Version'[[:space:]]*=>[[:space:]]*['|"]\$Revision\$['|"]/
86+
warn("Keyword $Revision$ is no longer needed.")
87+
end
88+
end
89+
6290
def check_badchars
6391
badchars = %Q|&<=>|
6492

@@ -299,6 +327,7 @@ def load_file(file)
299327

300328
def run_checks(f_rel)
301329
tidy = Msftidy.new(f_rel)
330+
tidy.check_old_keywords
302331
tidy.check_badchars
303332
tidy.check_extname
304333
tidy.test_old_rubies(f_rel)

0 commit comments

Comments
 (0)