Class: RubomaticHtml::Cop::Layout::TrailingWhitespace

Inherits:
Base
  • Object
show all
Defined in:
lib/rubomatic-html/cop/layout/trailing_whitespace.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

allowed_config_transform, #initialize

Constructor Details

This class inherits a constructor from RubomaticHtml::Cop::Base

Class Method Details

.abstract_cop?Boolean

Returns:

  • (Boolean)

See Also:

  • super


9
10
11
# File 'lib/rubomatic-html/cop/layout/trailing_whitespace.rb', line 9

def abstract_cop?
  false
end

.nameObject

See Also:

  • super


14
15
16
# File 'lib/rubomatic-html/cop/layout/trailing_whitespace.rb', line 14

def name
  [department, 'TrailingWhitespace'].join('/')
end

Instance Method Details

#run_for_line(line, index) ⇒ Object

See Also:

  • super


20
21
22
23
24
# File 'lib/rubomatic-html/cop/layout/trailing_whitespace.rb', line 20

def run_for_line(line, index)
  return unless line.match?(/\s\z/i)

  puts("#{file}:#{index}: has trailing whitespace")
end