Skip to content

chore: add frozen_string_literal to all Ruby files#216

Merged
josecolella merged 5 commits intomainfrom
chore/add-frozen-string-literal
Mar 5, 2026
Merged

chore: add frozen_string_literal to all Ruby files#216
josecolella merged 5 commits intomainfrom
chore/add-frozen-string-literal

Conversation

@josecolella
Copy link
Collaborator

Summary

  • Add # frozen_string_literal: true magic comment to the 13 .rb files that were missing it (10 in lib/, 3 in spec/)
  • All 45 .rb files in the codebase now consistently have the comment
  • All 272 tests continue to pass

Test plan

  • bundle exec rspec — 272 examples, 0 failures
  • grep -rL 'frozen_string_literal' --include='*.rb' . — no files missing

🤖 Jose's AI agent

@josecolella josecolella requested a review from a team as a code owner March 5, 2026 06:34
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request standardizes the inclusion of the # frozen_string_literal: true magic comment across all Ruby files in the repository. This change promotes string immutability by default, which can lead to performance improvements and prevent unexpected modifications of string objects, enhancing overall code quality and consistency without impacting existing functionality.

Highlights

  • Code Consistency: Added the # frozen_string_literal: true magic comment to 13 Ruby files that were missing it, ensuring all 45 .rb files in the codebase now consistently include this comment.
  • Test Coverage: Confirmed that all 272 existing tests continue to pass after the changes, indicating no regressions were introduced.
Changelog
  • lib/open_feature/sdk/client_metadata.rb
    • Added # frozen_string_literal: true magic comment
  • lib/open_feature/sdk/evaluation_context.rb
    • Added # frozen_string_literal: true magic comment
  • lib/open_feature/sdk/evaluation_context_builder.rb
    • Added # frozen_string_literal: true magic comment
  • lib/open_feature/sdk/evaluation_details.rb
    • Added # frozen_string_literal: true magic comment
  • lib/open_feature/sdk/provider.rb
    • Added # frozen_string_literal: true magic comment
  • lib/open_feature/sdk/provider/error_code.rb
    • Added # frozen_string_literal: true magic comment
    • Updated string literals to use single quotes for consistency
  • lib/open_feature/sdk/provider/in_memory_provider.rb
    • Added # frozen_string_literal: true magic comment
  • lib/open_feature/sdk/provider/provider_metadata.rb
    • Added # frozen_string_literal: true magic comment
  • lib/open_feature/sdk/provider/reason.rb
    • Added # frozen_string_literal: true magic comment
  • lib/open_feature/sdk/provider/resolution_details.rb
    • Added # frozen_string_literal: true magic comment
  • spec/open_feature/sdk/evaluation_context_builder_spec.rb
    • Added # frozen_string_literal: true magic comment
  • spec/open_feature/sdk/evaluation_context_spec.rb
    • Added # frozen_string_literal: true magic comment
  • spec/open_feature/sdk/provider/in_memory_provider_spec.rb
    • Added # frozen_string_literal: true magic comment
Activity
  • The pull request was created by 'Jose's AI agent' to address code consistency.
  • All 272 RSpec examples were executed and passed successfully.
  • A grep command confirmed no .rb files are missing the frozen_string_literal comment after the changes.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@josecolella josecolella force-pushed the chore/add-frozen-string-literal branch from 73c4eaf to 63d1da4 Compare March 5, 2026 06:35
@codecov
Copy link

codecov bot commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.64%. Comparing base (ee19450) to head (0c75e1a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #216   +/-   ##
=======================================
  Coverage   99.64%   99.64%           
=======================================
  Files          26       26           
  Lines         571      571           
=======================================
  Hits          569      569           
  Misses          2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds the # frozen_string_literal: true magic comment to multiple Ruby files. My review focuses on an inconsistency introduced in one of the files where string literals were changed from double to single quotes, while other files were not updated similarly. I've suggested reverting this part of the change to maintain a consistent style and to keep the pull request focused on a single concern. The style change for string quotes could be handled in a separate, more comprehensive pull request.

Comment on lines +7 to +14
PROVIDER_NOT_READY = 'PROVIDER_NOT_READY'
FLAG_NOT_FOUND = 'FLAG_NOT_FOUND'
PARSE_ERROR = 'PARSE_ERROR'
TYPE_MISMATCH = 'TYPE_MISMATCH'
TARGETING_KEY_MISSING = 'TARGETING_KEY_MISSING'
INVALID_CONTEXT = 'INVALID_CONTEXT'
PROVIDER_FATAL = 'PROVIDER_FATAL'
GENERAL = 'GENERAL'

Choose a reason for hiding this comment

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

medium

While using single quotes for frozen strings is good practice, this change introduces an inconsistency as other files with constants (e.g., lib/open_feature/sdk/provider/reason.rb) were not updated. To keep this PR focused on adding frozen_string_literal, it would be better to revert this change and address string quoting style across the project in a separate PR.

        PROVIDER_NOT_READY = "PROVIDER_NOT_READY"
        FLAG_NOT_FOUND = "FLAG_NOT_FOUND"
        PARSE_ERROR = "PARSE_ERROR"
        TYPE_MISMATCH = "TYPE_MISMATCH"
        TARGETING_KEY_MISSING = "TARGETING_KEY_MISSING"
        INVALID_CONTEXT = "INVALID_CONTEXT"
        PROVIDER_FATAL = "PROVIDER_FATAL"
        GENERAL = "GENERAL"

@josecolella josecolella force-pushed the chore/add-frozen-string-literal branch from 63d1da4 to 6aae28b Compare March 5, 2026 06:42
josecolella and others added 3 commits March 5, 2026 07:34
Add `# frozen_string_literal: true` to the 13 .rb files that were
missing it, for consistency across the codebase and to opt into
frozen string semantics.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Jose Colella <jose.colella@gusto.com>
Include commit signing requirement and development commands.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Jose Colella <jose.colella@gusto.com>
Also correct CLAUDE.md to document that Standard Ruby enforces
double-quoted strings, not single-quoted.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Jose Colella <jose.colella@gusto.com>
@josecolella josecolella force-pushed the chore/add-frozen-string-literal branch from bafbb57 to 786b9eb Compare March 5, 2026 15:34
josecolella and others added 2 commits March 5, 2026 07:35
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Jose Colella <jose.colella@gusto.com>
Signed-off-by: Jose Miguel Colella <josecolella@yahoo.com>
@josecolella josecolella enabled auto-merge (squash) March 5, 2026 15:54
@josecolella josecolella disabled auto-merge March 5, 2026 15:54
@josecolella josecolella merged commit 67b9796 into main Mar 5, 2026
17 checks passed
@josecolella josecolella deleted the chore/add-frozen-string-literal branch March 5, 2026 15:54
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.

1 participant