Class: OpenvoxLint::Checks
- Inherits:
-
Object
- Object
- OpenvoxLint::Checks
- Defined in:
- lib/openvox-lint/checks.rb
Overview
Runs all enabled checks against a tokenised manifest.
Instance Attribute Summary collapse
-
#problems ⇒ Object
readonly
Returns the value of attribute problems.
Instance Method Summary collapse
-
#initialize(tokens:, manifest_lines:, fullpath:, configuration:) ⇒ Checks
constructor
A new instance of Checks.
- #run ⇒ Object
Constructor Details
#initialize(tokens:, manifest_lines:, fullpath:, configuration:) ⇒ Checks
Returns a new instance of Checks.
8 9 10 11 12 13 14 15 |
# File 'lib/openvox-lint/checks.rb', line 8 def initialize(tokens:, manifest_lines:, fullpath:, configuration:) @tokens = tokens @manifest_lines = manifest_lines @fullpath = fullpath @configuration = configuration @problems = [] @ignore_comments = parse_ignore_comments end |
Instance Attribute Details
#problems ⇒ Object (readonly)
Returns the value of attribute problems.
6 7 8 |
# File 'lib/openvox-lint/checks.rb', line 6 def problems @problems end |
Instance Method Details
#run ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/openvox-lint/checks.rb', line 17 def run OpenvoxLint.checks.each do |name, klass| next unless @configuration.check_enabled?(name) plugin = klass.new results = plugin.run( tokens: @tokens, manifest_lines: @manifest_lines, fullpath: @fullpath, ignore_comments: @ignore_comments, ) @problems.concat(results) plugin.fix_problems if @configuration.fix && plugin.respond_to?(:fix_problems) end @problems.sort_by { |p| [p[:line] || 0, p[:column] || 0] } end |