Class: Pluginscan::UTF8Checker
- Inherits:
-
Object
- Object
- Pluginscan::UTF8Checker
- Defined in:
- lib/pluginscan/reports/issues_report/issues_scanner/utf8_checker.rb
Overview
Responsible for checking a file for utf-8 validity
Instance Method Summary collapse
-
#check(file_contents) ⇒ Object
TODO: This returns nil if the file was valid.
Instance Method Details
#check(file_contents) ⇒ Object
TODO: This returns nil if the file was valid. Returning nil is bad.
5 6 7 8 9 10 11 12 |
# File 'lib/pluginscan/reports/issues_report/issues_scanner/utf8_checker.rb', line 5 def check(file_contents) # Check file contents are valid UTF-8 file_contents.force_encoding('utf-8') return if file_contents.valid_encoding? CheckFindings.new( Check.new(name: 'Encoding', message: 'invalid UTF-8') ) end |