Class: LintTrappings::Command::DisplayLinters

Inherits:
Base
  • Object
show all
Defined in:
lib/lint_trappings/command/display_linters.rb

Overview

Displays all available linters and whether or not they are enabled.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from LintTrappings::Command::Base

Instance Method Details

#runObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/lint_trappings/command/display_linters.rb', line 6

def run
  LintTrappings::LinterLoader.new(application, config).load(options)

  linter_selector = LintTrappings::LinterSelector.new(config, options)
  all_linter_names = linter_selector.all_linter_classes.map(&:canonical_name)
  enabled_linter_names = linter_selector.enabled_linter_classes.map(&:canonical_name).to_set

  all_linter_names.sort.each do |linter_name|
    output.print(' - ')
    output.bold(linter_name, false)
    if enabled_linter_names.include?(linter_name)
      output.success(' enabled')
    else
      output.error(' disabled')
    end
  end
end