lib/reek/adapters/application.rb in reek-1.2.2 vs lib/reek/adapters/application.rb in reek-1.2.3
- old
+ new
@@ -1,10 +1,17 @@
require 'reek/adapters/command_line'
require 'reek/adapters/source'
require 'reek/adapters/core_extras'
module Reek
+
+ EXIT_STATUS = {
+ :success => 0,
+ :error => 1,
+ :smells => 2
+ }
+
#
# Represents an instance of a Reek application.
# This is the entry point for all invocations of Reek from the
# command line.
#
@@ -25,20 +32,20 @@
end
def reek
examine_sources
puts @options.create_report(@sniffer.sniffers).report
- return @sniffer.smelly? ? 2 : 0
+ return EXIT_STATUS[@sniffer.smelly? ? :smells : :success]
end
def execute
begin
return reek
rescue SystemExit => ex
return ex.status
rescue Exception => error
$stderr.puts "Error: #{error}"
- return 1
+ return EXIT_STATUS[:error]
end
end
end
end