Skip to content

Commit

Permalink
Document support for frozen_string_literal: false
Browse files Browse the repository at this point in the history
xref #7426
  • Loading branch information
gfyoung authored and bbatsov committed Oct 21, 2019
1 parent 8b8141b commit 4254691
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/rubocop/cop/style/frozen_string_literal_comment.rb
Expand Up @@ -11,6 +11,9 @@ module Style
# encoding comment. The frozen string literal comment is only valid in
# Ruby 2.3+.
#
# Note that the cop will ignore files where the comment exists but is set
# to `false` instead of `true`.
#
# @example EnforcedStyle: always (default)
# # The `always` style will always add the frozen string literal comment
# # to a file, regardless of the Ruby version or if `freeze` or `<<` are
Expand All @@ -27,6 +30,13 @@ module Style
# # ...
# end
#
# # good
# # frozen_string_literal: false
#
# module Bar
# # ...
# end
#
# @example EnforcedStyle: never
# # The `never` will enforce that the frozen string literal comment does
# # not exist in a file.
Expand Down
10 changes: 10 additions & 0 deletions manual/cops_style.md
Expand Up @@ -2281,6 +2281,9 @@ default in future Ruby. The comment will be added below a shebang and
encoding comment. The frozen string literal comment is only valid in
Ruby 2.3+.

Note that the cop will ignore files where the comment exists but is set
to `false` instead of `true`.

### Examples

#### EnforcedStyle: always (default)
Expand All @@ -2297,6 +2300,13 @@ end
# good
# frozen_string_literal: true
module Bar
# ...
end
# good
# frozen_string_literal: false
module Bar
# ...
end
Expand Down

0 comments on commit 4254691

Please sign in to comment.