Sha256: 9cf138f3454385c018598089ea6b57dda312d980cd850ae9442968e626314d59

Contents?: true

Size: 460 Bytes

Versions: 8

Compression:

Stored size: 460 Bytes

Contents

module Codeqa
  module Checkers
    class CheckUtf8Encoding < Checker
      def self.check?(sourcefile)
        sourcefile.text?
      end

      def name
        'utf8 encoding'
      end

      def hint
        'The file contains non utf8 characters. Find and remove them.'
      end

      def check
        return if sourcefile.content.force_encoding('UTF-8').valid_encoding?
        errors.add(nil, 'encoding error, not utf8')
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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