Class: OpenvoxLint::CheckPlugin

Inherits:
Object
  • Object
show all
Defined in:
lib/openvox-lint/check_plugin.rb

Overview

Base class for every lint check. Subclass via OpenvoxLint.new_check.

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCheckPlugin

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_nameObject (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

#problemsObject (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_problemsObject



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