class Codeqa::Checkers::CheckStrangeChars

Public Class Methods

check?(sourcefile) click to toggle source
# File lib/codeqa/checkers/check_strange_chars.rb, line 14
def self.check?(sourcefile)
  sourcefile.text?
end

Private Class Methods

pattern() click to toggle source
# File lib/codeqa/checkers/check_strange_chars.rb, line 20
def self.pattern
  @pattern ||= /(\x09|\x0c)/
end

Public Instance Methods

hint() click to toggle source
# File lib/codeqa/checkers/check_strange_chars.rb, line 10
def hint
  'The file contains a tab or form feed. Remove them.'
end
name() click to toggle source
# File lib/codeqa/checkers/check_strange_chars.rb, line 6
def name
  'strange chars'
end

Private Instance Methods

error_msg(line, line_number, pos) click to toggle source
# File lib/codeqa/checkers/check_strange_chars.rb, line 23
def error_msg(line, line_number, pos)
  strangeness = (line.include?("\x09") ? 'TAB x09' : 'FORM FEED x0C')
  "#{strangeness} at line #{line_number} column #{pos + 1}"
end