Class: Ace::Lint::Atoms::RuboCopRunner
- Inherits:
-
BaseRunner
- Object
- BaseRunner
- Ace::Lint::Atoms::RuboCopRunner
- Defined in:
- lib/ace/lint/atoms/rubocop_runner.rb
Overview
Executes RuboCop linter and parses results Used as fallback when StandardRB is not available
Class Method Summary collapse
-
.build_command(paths, fix:, config_path: nil) ⇒ Array<String>
Build RuboCop command Flag mapping: –fix → –autocorrect, –fix-unsafely → –autocorrect-all Config precedence: explicit config_path > bundled defaults.
-
.unavailable_result ⇒ Hash
Result when neither StandardRB nor RuboCop is available.
Methods inherited from BaseRunner
available?, build_offense_item, parse_error_output, parse_json_output, parse_success_output, parse_text_output, reset_availability_cache!, run
Class Method Details
.build_command(paths, fix:, config_path: nil) ⇒ Array<String>
Build RuboCop command Flag mapping: –fix → –autocorrect, –fix-unsafely → –autocorrect-all Config precedence: explicit config_path > bundled defaults
19 20 21 22 23 24 25 26 27 |
# File 'lib/ace/lint/atoms/rubocop_runner.rb', line 19 def build_command(paths, fix:, config_path: nil) autofix_flags = fix ? ["--autocorrect"] : [] # Use explicit config_path if provided, otherwise fall back to bundled config effective_config = config_path || find_bundled_config config_flags = effective_config ? ["--config", effective_config] : [] ["rubocop", *config_flags, *autofix_flags, "--format", "json", *paths].compact end |
.unavailable_result ⇒ Hash
Result when neither StandardRB nor RuboCop is available
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ace/lint/atoms/rubocop_runner.rb', line 31 def unavailable_result { success: false, errors: [{ message: "No Ruby linter available. Install StandardRB (preferred): gem install standardrb" \ " - or RuboCop: gem install rubocop" }], warnings: [] } end |