Sha256: 7700f426764493c563dfc91917fd9a3ed498d747c50b7077e7809620c09aaa11

Contents?: true

Size: 622 Bytes

Versions: 8

Compression:

Stored size: 622 Bytes

Contents

require 'codeqa/checkers/pattern_checker'

module Codeqa
  module Checkers
    class CheckStrangeChars < PatternChecker
      def name
        'strange chars'
      end

      def hint
        'The file contains a tab or form feed. Remove them.'
      end

      def self.check?(sourcefile)
        sourcefile.text?
      end

    private

      def self.pattern
        @pattern ||= /(\x09|\x0c)/
      end
      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
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
codeqa-0.5.0 lib/codeqa/checkers/check_strange_chars.rb
codeqa-0.4.2 lib/codeqa/checkers/check_strange_chars.rb
codeqa-0.4.1 lib/codeqa/checkers/check_strange_chars.rb
codeqa-0.4.0 lib/codeqa/checkers/check_strange_chars.rb
codeqa-0.4.0.pre2 lib/codeqa/checkers/check_strange_chars.rb
codeqa-0.4.0.pre lib/codeqa/checkers/check_strange_chars.rb
codeqa-0.3.1 lib/codeqa/checkers/check_strange_chars.rb
codeqa-0.3.0 lib/codeqa/checkers/check_strange_chars.rb