lib/quality/quality_checker.rb in quality-20.1.0 vs lib/quality/quality_checker.rb in quality-20.1.1
- old
+ new
@@ -53,12 +53,12 @@
end
def check_exit_status(exit_status)
return if @command_options[:gives_error_code_on_violations] ||
@command_options[:gives_error_code_on_no_relevant_code]
- fail("Error detected running #{full_cmd}. " \
- "Exit status is #{exit_status}") if exit_status != 0
+ raise("Error detected running #{full_cmd}. " \
+ "Exit status is #{exit_status}") if exit_status.nonzero?
end
def existing_violations
if @count_file.exist?(@filename)
@count_io.read(@filename).to_i
@@ -69,24 +69,22 @@
def ratchet_violations
existing = existing_violations
report_violations(existing)
if @violations > existing
- fail("Output from #{@cmd}\n\n#{@command_output}\n\n" \
- "Reduce total number of #{@cmd} violations " \
- "to #{existing} or below!")
+ raise("Output from #{@cmd}\n\n#{@command_output}\n\n" \
+ "Reduce total number of #{@cmd} violations " \
+ "to #{existing} or below!")
elsif @violations < existing
puts 'Ratcheting quality up...'
write_violations(@violations)
end
end
def report_violations(existing)
puts "Existing violations: #{existing}"
puts "Found #{@violations} #{@cmd} violations"
end
-
- private
def full_cmd
args = @command_options[:args] || ''
@found_output = false
RubySpawn.new(@cmd, args).invocation