Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Emacs style frozen string literal comment check #6380

Merged
merged 1 commit into from Oct 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -15,6 +15,7 @@
* [#5538](https://github.com/rubocop-hq/rubocop/issues/5538): Fix false negatives in modifier cops when line length cop is disabled. ([@drenmi][])
* [#6340](https://github.com/rubocop-hq/rubocop/pull/6340): Fix an error for `Rails/ReversibleMigration` when block argument is empty. ([@koic][])
* [#6274](https://github.com/rubocop-hq/rubocop/issues/6274): Fix "[Corrected]" message being displayed even when nothing has been corrected. ([@jekuta][])
* [#6380](https://github.com/rubocop-hq/rubocop/pull/6380): Allow use of a hyphen-separated frozen string literal in Emacs style magic comment. ([@y-yagi][])

### Changes

Expand Down Expand Up @@ -3620,3 +3621,4 @@
[@lukasz-wojcik]: https://github.com/lukasz-wojcik
[@albaer]: https://github.com/albaer
[@Kevinrob]: https://github.com/Kevinrob
[@y-yagi]: https://github.com/y-yagi
2 changes: 1 addition & 1 deletion lib/rubocop/magic_comment.rb
Expand Up @@ -140,7 +140,7 @@ def encoding
private

def extract_frozen_string_literal
match('frozen_string_literal')
match('frozen[_-]string[_-]literal')
end
end

Expand Down
4 changes: 4 additions & 0 deletions spec/rubocop/magic_comment_spec.rb
Expand Up @@ -73,6 +73,10 @@
'# fRoZeN-sTrInG_lItErAl: true',
frozen_string_literal: true

include_examples 'magic comment',
'# -*- frozen-string-literal: true -*-',
frozen_string_literal: true

include_examples 'magic comment',
'# frozen_string_literal: invalid',
frozen_string_literal: 'invalid'
Expand Down