Sha256: d25da57e3d484e0e3e0032b5b1f823538d2cde84fea0cd087da605bfb3b8ad62

Contents?: true

Size: 531 Bytes

Versions: 6

Compression:

Stored size: 531 Bytes

Contents

module Codeqa
  module Checkers
    class PatternChecker < Checker
      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

      def self.available?
        respond_to?(:pattern)
      end

    private

      def pattern
        self.class.pattern
      end

      def error_msg(*_args)
        raise 'not implemented'
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
codeqa-0.5.0 lib/codeqa/checkers/pattern_checker.rb
codeqa-0.4.2 lib/codeqa/checkers/pattern_checker.rb
codeqa-0.4.1 lib/codeqa/checkers/pattern_checker.rb
codeqa-0.4.0 lib/codeqa/checkers/pattern_checker.rb
codeqa-0.4.0.pre2 lib/codeqa/checkers/pattern_checker.rb
codeqa-0.4.0.pre lib/codeqa/checkers/pattern_checker.rb