Class: OpenvoxLint::CheckPlugin
- Inherits:
-
Object
- Object
- OpenvoxLint::CheckPlugin
- Defined in:
- lib/openvox-lint/check_plugin.rb
Overview
Base class for every lint check. Subclass via OpenvoxLint.new_check.
Class Attribute Summary collapse
-
.check_name ⇒ Object
readonly
Returns the value of attribute check_name.
Instance Attribute Summary collapse
-
#problems ⇒ Object
readonly
Returns the value of attribute problems.
Instance Method Summary collapse
- #fix_problems ⇒ Object
-
#initialize ⇒ CheckPlugin
constructor
A new instance of CheckPlugin.
- #run(tokens:, manifest_lines:, fullpath:, ignore_comments: []) ⇒ Object
Constructor Details
#initialize ⇒ CheckPlugin
Returns a new instance of CheckPlugin.
12 13 14 |
# File 'lib/openvox-lint/check_plugin.rb', line 12 def initialize @problems = [] end |
Class Attribute Details
.check_name ⇒ Object (readonly)
Returns the value of attribute check_name.
9 10 11 |
# File 'lib/openvox-lint/check_plugin.rb', line 9 def check_name @check_name end |
Instance Attribute Details
#problems ⇒ Object (readonly)
Returns the value of attribute problems.
6 7 8 |
# File 'lib/openvox-lint/check_plugin.rb', line 6 def problems @problems end |
Instance Method Details
#fix_problems ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/openvox-lint/check_plugin.rb', line 29 def fix_problems @problems.each do |problem| fix(problem) rescue OpenvoxLint::NoFix next end end |
#run(tokens:, manifest_lines:, fullpath:, ignore_comments: []) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/openvox-lint/check_plugin.rb', line 16 def run(tokens:, manifest_lines:, fullpath:, ignore_comments: []) @tokens = tokens @manifest_lines = manifest_lines @fullpath = fullpath @path = fullpath @filename = File.basename(fullpath) @problems = [] @ignore_comments = ignore_comments check @problems.reject! { |p| ignored?(p) } @problems end |