Sha256: a4e4c9552cc42cf2a85533e8898b07735e4c4d2c84642ab5a51d1cdcd2be2db0
Contents?: true
Size: 942 Bytes
Versions: 5
Compression:
Stored size: 942 Bytes
Contents
# encoding: utf-8 module Rubocop module Cop module Style # This cop checks whether the source file has a # utf-8 encoding comment. This check makes sense only # in Ruby 1.9, since in 2.0+ utf-8 is the default source file # encoding. class Encoding < Cop MSG = 'Missing utf-8 encoding comment.' def investigate(processed_source) unless RUBY_VERSION >= '2.0.0' line_number = 0 line_number += 1 if processed_source[line_number] =~ /^#!/ line = processed_source[line_number] unless line =~ /#.*coding\s?[:=]\s?(UTF|utf)-8/ convention(nil, source_range(processed_source.buffer, processed_source[0...line_number], 0, 1), MSG) end end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems