Class: Maximus::Rubocop

Inherits:
Lint
  • Object
show all
Defined in:
lib/maximus/lints/rubocop.rb

Overview

Since:

  • 0.1.0

Instance Attribute Summary

Attributes inherited from Lint

#output

Instance Method Summary collapse

Methods inherited from Lint

#initialize, #refine

Methods included from Helper

#check_default_config_path, #edit_yaml, #file_count, #file_list, #is_rails?, #lines_added_to_range, #node_module_exists, #path_exists, #prompt, #reporter_path, #root_dir, #truthy

Constructor Details

This class inherits a constructor from Maximus::Lint

Instance Method Details

#resultObject

RuboCop

See Also:

Since:

  • 0.1.0


8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/maximus/lints/rubocop.rb', line 8

def result
  @task = 'rubocop'

  return unless temp_config(@task)

  @path = is_rails? ? "#{@settings[:root_dir]}/app" : "#{@settings[:root_dir]}/*.rb" if @path.blank?

  return unless path_exists(@path)

  rubo = `rubocop #{@path} --require #{reporter_path('rubocop')} --config #{temp_config(@task)} --format RuboCop::Formatter::MaximusRuboFormatter #{'-R' if is_rails?}`

  @output[:files_inspected] ||= files_inspected('rb', ' ')
  refine rubo
end