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 #7332] Update doc for `Style/FrozenStringLiteralComment` #7334

Conversation

@koic
Copy link
Member

commented Sep 5, 2019

Closes #7332.

This PR updates a description to Ruby version where frozen string literals will be introduced.

AFAIK, matz has not given up the possibility of defaulting to a frozen string in the future. In Ruby 3.0, matz was abandant for changing it because there were not enough tools to prevent destructive changes (I heard that at RubyKaigi 2019 and RubyConf Taiwan 2019).

Frozen string literals are being introduced around Ruby.

So this cop remains enabled by default.

cf. https://bugs.ruby-lang.org/issues/11473#note-53


Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.
# enable frozen string literals. Frozen string literals may be default
# after Ruby 3.0. The comment will be added below a shebang and encoding
# comment. The frozen string literal comment is only valid in Ruby 2.3+.
# This cop is designed to help mutable string literals to frozen string

This comment has been minimized.

Copy link
@bbatsov

bbatsov Sep 5, 2019

Collaborator

to help you transition from mutable...

I guess we can still add some explanation that there's a chance that string literals in Ruby will become frozen by default at some point in the future.

This comment has been minimized.

Copy link
@koic

koic Sep 6, 2019

Author Member

Thanks for your review. I updated the description.

@koic koic force-pushed the koic:update_doc_for_style_frozen_string_literal_comment branch 2 times, most recently from c1707c8 to 5ae8a94 Sep 6, 2019

[Fix #7332] Update doc for `Style/FrozenStringLiteralComment`
Closes #7332.

This PR updates a description to Ruby version where frozen string literals
will be introduced.

AFAIK, matz has not given up the possibility of defaulting to a frozen
string in the future. In Ruby 3.0, matz was abandant for changing it
because there were not enough tools to prevent destructive changes
(I heard that at RubyKaigi 2019 and RubyConf Taiwan 2019).

Frozen string literals are being introduced around Ruby.

- https://github.com/ruby/ruby/blob/master/lib/erb.rb
- https://github.com/ruby/psych
- https://github.com/ruby/csv
- https://github.com/rubygems/rubygems
- https://github.com/bundler/bundler
- others

So this cop remains enabled by default.

cf. https://bugs.ruby-lang.org/issues/11473#note-53

@koic koic force-pushed the koic:update_doc_for_style_frozen_string_literal_comment branch from 5ae8a94 to 44d1beb Sep 12, 2019

@bbatsov bbatsov merged commit 84ac2b4 into rubocop-hq:master Sep 15, 2019

20 of 22 checks passed

ci/circleci: ruby-head-ascii_spec Your tests failed on CircleCI
Details
ci/circleci: ruby-head-spec Your tests failed on CircleCI
Details
ci/circleci: cc-setup Your tests passed on CircleCI!
Details
ci/circleci: cc-upload-coverage Your tests passed on CircleCI!
Details
ci/circleci: documentation-checks Your tests passed on CircleCI!
Details
ci/circleci: jruby-9.2-ascii_spec Your tests passed on CircleCI!
Details
ci/circleci: jruby-9.2-rubocop Your tests passed on CircleCI!
Details
ci/circleci: jruby-9.2-spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.3-ascii_spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.3-rubocop Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.3-spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.4-ascii_spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.4-rubocop Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.4-spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.5-ascii_spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.5-rubocop Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.5-spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.6-ascii_spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.6-rubocop Your tests passed on CircleCI!
Details
ci/circleci: ruby-2.6-spec Your tests passed on CircleCI!
Details
ci/circleci: ruby-head-rubocop Your tests passed on CircleCI!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
@bbatsov

This comment has been minimized.

Copy link
Collaborator

commented Sep 15, 2019

Thanks!

Probably we should update the Ruby style guide as well with similar wording.

@koic koic deleted the koic:update_doc_for_style_frozen_string_literal_comment branch Sep 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.