Class: LintTrap::Linter::Base
- Inherits:
-
Object
- Object
- LintTrap::Linter::Base
- Defined in:
- lib/lint_trap/linter/base.rb
Overview
The base class for all linters. Provides a template for linter execution.
Direct Known Subclasses
CPPCheck, CSSLint, CheckStyle, CoffeeLint, GoLint, JSHint, JSONLint, PyLint, RuboCop, SCSSLint
Constant Summary collapse
- CONFIG_PATH =
File.('../../../../config', __FILE__)
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(container:, **options) ⇒ Base
constructor
A new instance of Base.
- #lint(files) ⇒ Object
- #name ⇒ Object
Constructor Details
#initialize(container:, **options) ⇒ Base
Returns a new instance of Base.
14 15 16 17 |
# File 'lib/lint_trap/linter/base.rb', line 14 def initialize(container:, **) @container = container @options = end |
Class Method Details
.canonical_name ⇒ Object
10 11 12 |
# File 'lib/lint_trap/linter/base.rb', line 10 def self.canonical_name name.split('::').last end |
Instance Method Details
#lint(files) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/lint_trap/linter/base.rb', line 19 def lint(files) command(files).run(container) do |stdout| parser(stdout).parse do |violation| yield violation end end end |
#name ⇒ Object
27 28 29 |
# File 'lib/lint_trap/linter/base.rb', line 27 def name self.class.canonical_name end |