Class: Codeqa::Checkers::CheckUtf8Encoding
Instance Attribute Summary
#errors, #sourcefile
Class Method Summary
collapse
Instance Method Summary
collapse
available?, #initialize
Class Method Details
.check?(sourcefile) ⇒ Boolean
4
5
6
|
# File 'lib/codeqa/checkers/check_utf8_encoding.rb', line 4
def self.check?(sourcefile)
sourcefile.text?
end
|
Instance Method Details
#check ⇒ Object
16
17
18
19
|
# 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 ⇒ Object
12
13
14
|
# File 'lib/codeqa/checkers/check_utf8_encoding.rb', line 12
def hint
'The file contains non utf8 characters. Find and remove them.'
end
|
#name ⇒ Object
8
9
10
|
# File 'lib/codeqa/checkers/check_utf8_encoding.rb', line 8
def name
'utf8 encoding'
end
|