Skip to content

Commit af27719

Browse files
committed
check for valid values
1 parent 4469fcd commit af27719

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tools/msftidy.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,14 @@ def check_lines
545545
warn("Please use snake case on method names: #{ln}", idx)
546546
end
547547

548-
if ln =~ /fail_with\(['"].+['"]\)/
549-
error("fail_with requires a Failure:: reason as first parameter: #{ln}", idx)
548+
if ln =~ /fail_with\(/
549+
if ln =~ /fail_with\(['"].+['"]\)/
550+
error("fail_with requires a Failure:: reason as first parameter: #{ln}", idx)
551+
elsif ln !~ /fail_with\(Failure\:\:(?:None|Unknown|Unreachable|BadConfig|Disconnected|NotFound|UnexpectedReply|TimeoutExpired|UserInterrupt|NoAccess|NoTarget|NotVulnerable|PayloadFailed),\s*['"].+['"]\)/
552+
error("fail_with requires a valid Failure:: reason as first parameter: #{ln}", idx)
553+
end
550554
end
555+
551556
end
552557
end
553558

0 commit comments

Comments
 (0)