class Codeqa::Checkers::CheckUtf8Encoding

Public Class Methods

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

Public Instance Methods

check() click to toggle source
# File lib/codeqa/checkers/check_utf8_encoding.rb, line 16
def check
  return if sourcefile.content.force_encoding('UTF-8').valid_encoding?
  errors.add(nil, 'encoding error, not utf8')
end
hint() click to toggle source
# File lib/codeqa/checkers/check_utf8_encoding.rb, line 12
def hint
  'The file contains non utf8 characters. Find and remove them.'
end
name() click to toggle source
# File lib/codeqa/checkers/check_utf8_encoding.rb, line 8
def name
  'utf8 encoding'
end