Sha256: 45d1bfc3e71e425185eb9e498349a18f24140246a0cad503a4986347f98297c6

Contents?: true

Size: 464 Bytes

Versions: 4

Compression:

Stored size: 464 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    class Encoding < Cop
      MSG = 'Missing utf-8 encoding comment.'

      def inspect(source, tokens, ast, comments)
        unless RUBY_VERSION >= '2.0.0'
          expected_line = 0
          expected_line += 1 if source[expected_line] =~ /^#!/
          unless source[expected_line] =~ /#.*coding: (UTF|utf)-8/
            add_offence(:convention, 1, MSG)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.8.3 lib/rubocop/cop/encoding.rb
rubocop-0.8.2 lib/rubocop/cop/encoding.rb
rubocop-0.8.1 lib/rubocop/cop/encoding.rb
rubocop-0.8.0 lib/rubocop/cop/encoding.rb