Class: RubomaticHtml::Cop::Style::PartialInstanceVariable
- Inherits:
-
Base
- Object
- Base
- Base
- RubomaticHtml::Cop::Style::PartialInstanceVariable
show all
- Defined in:
- lib/rubomatic-html/cop/style/partial_instance_variable.rb
Instance Attribute Summary
Attributes inherited from Base
#config, #file
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
department
Methods inherited from Base
#initialize
Class Method Details
.abstract_cop? ⇒ Boolean
9
10
11
|
# File 'lib/rubomatic-html/cop/style/partial_instance_variable.rb', line 9
def abstract_cop?
false
end
|
19
20
21
|
# File 'lib/rubomatic-html/cop/style/partial_instance_variable.rb', line 19
def allowed_config_transform
super.merge({ 'AllowedIdentifiers' => :allowed_identifiers }).freeze
end
|
.name ⇒ Object
14
15
16
|
# File 'lib/rubomatic-html/cop/style/partial_instance_variable.rb', line 14
def name
[department, 'PartialInstanceVariable'].join('/')
end
|
Instance Method Details
#run_for_line(line, index) ⇒ Object
25
26
27
28
29
30
31
32
33
|
# File 'lib/rubomatic-html/cop/style/partial_instance_variable.rb', line 25
def run_for_line(line, index)
return unless File.basename(file).match?(/^_/i)
return unless line.match?(/@/i)
return if allowed_identifiers.any? { |ai| line[/@.+/].start_with?(ai) }
puts("#{file}:#{index}: uses an instance variable")
end
|