class RuboCop::CLI
def run(args = ARGV)
-
(Integer)
- UNIX exit code
Parameters:
-
args
(Array
) -- command line arguments
Other tags:
- Api: - public
def run(args = ARGV) @options, paths = Options.new.parse(args) @env = Environment.new(@options, @config_store, paths) profile_if_needed do if @options[:init] run_command(:init) else act_on_options validate_options_vs_config parallel_by_default! apply_default_formatter execute_runners end end rescue ConfigNotFoundError, IncorrectCopNameError, OptionArgumentError => e warn Rainbow(e.message).red STATUS_ERROR rescue RuboCop::Error => e warn Rainbow("Error: #{e.message}").red STATUS_ERROR rescue Interrupt warn '' warn 'Exiting...' STATUS_INTERRUPTED rescue Finished STATUS_SUCCESS rescue OptionParser::InvalidOption => e warn e.message warn 'For usage information, use --help' STATUS_ERROR rescue StandardError, SyntaxError, LoadError => e warn e.message warn e.backtrace STATUS_ERROR end