Skip to content

Files

Latest commit

 

History

History
34 lines (22 loc) · 701 Bytes

Lint-OrderedMagicComments.md

File metadata and controls

34 lines (22 loc) · 701 Bytes

Pattern: Wrong order of magic comments

Issue: -

Description

Checks the proper ordering of magic comments and whether a magic comment is not placed before a shebang.

Examples

# bad

# frozen_string_literal: true
# encoding: ascii
p [''.frozen?, ''.encoding] #=> [true, #<Encoding:UTF-8>]

# good

# encoding: ascii
# frozen_string_literal: true
p [''.frozen?, ''.encoding] #=> [true, #<Encoding:US-ASCII>]

# good

#!/usr/bin/env ruby
# encoding: ascii
# frozen_string_literal: true
p [''.frozen?, ''.encoding] #=> [true, #<Encoding:US-ASCII>]

Further Reading