Skip to content

Commit 64dca2d

Browse files
committed
Land rapid7#8969, msftidy exit code rework
2 parents 273d49b + 7578913 commit 64dca2d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tools/dev/msftidy.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ def ascii_only?
4343
class Msftidy
4444

4545
# Status codes
46-
OK = 0x00
47-
WARNINGS = 0x10
48-
ERRORS = 0x20
46+
OK = 0
47+
INFO = 1
48+
WARNING = 2
49+
ERROR = 3
4950

5051
# Some compiles regexes
5152
REGEX_MSF_EXPLOIT = / \< Msf::Exploit/
@@ -73,7 +74,7 @@ def initialize(source_file)
7374
# error.
7475
def warn(txt, line=0) line_msg = (line>0) ? ":#{line}" : ''
7576
puts "#{@full_filepath}#{line_msg} - [#{'WARNING'.yellow}] #{cleanup_text(txt)}"
76-
@status == ERRORS ? @status = ERRORS : @status = WARNINGS
77+
@status += WARNING
7778
end
7879

7980
#
@@ -85,7 +86,7 @@ def warn(txt, line=0) line_msg = (line>0) ? ":#{line}" : ''
8586
def error(txt, line=0)
8687
line_msg = (line>0) ? ":#{line}" : ''
8788
puts "#{@full_filepath}#{line_msg} - [#{'ERROR'.red}] #{cleanup_text(txt)}"
88-
@status = ERRORS
89+
@status += ERROR
8990
end
9091

9192
# Currently unused, but some day msftidy will fix errors for you.
@@ -101,6 +102,7 @@ def info(txt, line=0)
101102
return if SUPPRESS_INFO_MESSAGES
102103
line_msg = (line>0) ? ":#{line}" : ''
103104
puts "#{@full_filepath}#{line_msg} - [#{'INFO'.cyan}] #{cleanup_text(txt)}"
105+
@status += INFO
104106
end
105107

106108
##

0 commit comments

Comments
 (0)