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

Enable frozen_strings_literal #626

Merged
merged 6 commits into from
Jan 9, 2025
Merged

Conversation

mokagio
Copy link
Contributor

@mokagio mokagio commented Jan 9, 2025

What does it do?

Closes #625

Because most of the changes were done by bundle exec rubocop -A I addressed the test failures resulting to the code switching to immutable strings in dedicated commits. I hope it makes it easier to review.

Checklist before requesting a review

  • Run bundle exec rubocop to test for code style violations and recommendations
  • Add Unit Tests (aka specs/*_spec.rb) if applicable
  • Run bundle exec rspec to run the whole test suite and ensure all your tests pass
  • Make sure you added an entry in the CHANGELOG.md file to describe your changes under the appropriate existing ### subsection of the existing ## Trunk section.
  • If applicable, add an entry in the MIGRATION.md file to describe how the changes will affect the migration from the previous major version and what the clients will need to change and consider. — N.A.

@dangermattic
Copy link
Collaborator

dangermattic commented Jan 9, 2025

1 Warning
⚠️ Gemfile was changed without updating its corresponding Gemfile.lock. Please run bundle install or bundle update <updated_gem>.

Generated by 🚫 Danger

@mokagio mokagio force-pushed the mokagio/frozen-strings-literal branch from 26f8f34 to bceed35 Compare January 9, 2025 07:01
@mokagio mokagio enabled auto-merge January 9, 2025 07:03
@mokagio mokagio requested a review from a team January 9, 2025 07:03
@@ -30,13 +30,6 @@ Style/EmptyMethod:
Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: consistent_comma

# Enabling the 'frozen_string_literal: true' comment is nice but should be done with extra care
# because enabling it on code that accidentally mutates string literals will crash at runtime
# (e.g. `name = 'Hello'` then later `name << ' world'` will crash if the comment is enabled)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's hope we don't have many of such cases -- I think the more recent actions are probably fine. I guess the concern is more on the older ones, without much testing.

And I think we're all aware that issues caused by this kind of change (or any change in Fastlane related tooling, really) would be caught only during an app release -- I always wonder if we could come up with a way to mitigate this problem or just accept that as inevitable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah... I think this is a situation where it's more about how we react to issues than how we prevent them. Because to fully prevent them we would have to run a copy of each of our app's release scenario, which would take a long time. I'd like to think we can nimbly fix issues that might arise at release time and that it would be a more effective use of our time.

Copy link
Contributor

@iangmaia iangmaia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran the updated codebase through Claude (which gave its ok) and checked a few things myself just in case.

:shipit:

@mokagio mokagio merged commit ffacf8a into trunk Jan 9, 2025
6 of 7 checks passed
@mokagio mokagio deleted the mokagio/frozen-strings-literal branch January 9, 2025 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should we enable the FrozenStringLiteralComment lint?
3 participants