class Codeqa::Checkers::PatternChecker

Public Class Methods

available?() click to toggle source
# File lib/codeqa/checkers/pattern_checker.rb, line 11
def self.available?
  respond_to?(:pattern)
end

Public Instance Methods

check() click to toggle source
# File lib/codeqa/checkers/pattern_checker.rb, line 4
def check
  sourcefile.content.lines.each.with_index do |line, line_number|
    pos = (line =~ pattern)
    errors.add([line_number + 1, pos + 1], error_msg(line, line_number + 1, pos)) if pos
  end
end

Private Instance Methods

error_msg(*_args) click to toggle source
# File lib/codeqa/checkers/pattern_checker.rb, line 21
def error_msg(*_args)
  raise 'not implemented'
end
pattern() click to toggle source
# File lib/codeqa/checkers/pattern_checker.rb, line 17
def pattern
  self.class.pattern
end