Update configuration for frozen-string-literal#1971
Merged
jack-edmonds-dd merged 2 commits intoDataDog:masterfrom Oct 1, 2024
Merged
Update configuration for frozen-string-literal#1971jack-edmonds-dd merged 2 commits intoDataDog:masterfrom
jack-edmonds-dd merged 2 commits intoDataDog:masterfrom
Conversation
In a future Ruby version strings will be frozen by default. You can simulate the new behavior with RUBYOPT="--enable-frozen-string-literal". With this enabled the url from configuration is mutated by gsub!. We can avoid this by marking these strings as mutable.
|
This PR has been automatically marked as stale because it has not had activity in the last 30 days. |
Contributor
Author
|
Please say open ❤️ |
jack-edmonds-dd
approved these changes
Oct 1, 2024
Contributor
|
Merging since CI checks passed in #2037 |
github-actions bot
pushed a commit
that referenced
this pull request
Oct 1, 2024
In a future Ruby version strings will be frozen by default. You can simulate the new behavior with RUBYOPT="--enable-frozen-string-literal". With this enabled the url from configuration is mutated by gsub!. We can avoid this by marking these strings as mutable. Co-authored-by: jack-edmonds-dd <jack.edmonds@datadoghq.com> f3b30c6
4 tasks
skarimo
added a commit
that referenced
this pull request
May 15, 2025
- The PR #1971 fixed frozen string errors. - But when the templates regenerated, the `+` on each `url` string went away. So now we're seeing these errors again with the current gem version on Ruby 3.4. - This attempts to fix them more durably by persisting the `+` for marking the string as mutable to the template itself. ``` /workspaces/github/vendor/gems/3.4.3/ruby/3.4.0/gems/datadog_api_client-2.33.0/lib/datadog_api_client/configuration.rb:619: warning: literal string will be frozen in the future (run with --debug-frozen-string-literal for more information) ``` Co-authored-by: skarimo <40482491+skarimo@users.noreply.github.com>
github-actions bot
pushed a commit
that referenced
this pull request
May 15, 2025
- The PR #1971 fixed frozen string errors. - But when the templates regenerated, the `+` on each `url` string went away. So now we're seeing these errors again with the current gem version on Ruby 3.4. - This attempts to fix them more durably by persisting the `+` for marking the string as mutable to the template itself. ``` /workspaces/github/vendor/gems/3.4.3/ruby/3.4.0/gems/datadog_api_client-2.33.0/lib/datadog_api_client/configuration.rb:619: warning: literal string will be frozen in the future (run with --debug-frozen-string-literal for more information) ``` Co-authored-by: skarimo <40482491+skarimo@users.noreply.github.com> 69fda88
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In a future Ruby version strings will be frozen by default. You can simulate the new behavior with RUBYOPT="--enable-frozen-string-literal". With this enabled the url from configuration is mutated by gsub!. We can avoid this by marking these strings as mutable.
The error I hit running the test suite with was a string mutation from: https://github.com/DataDog/datadog-api-client-ruby/blob/master/lib/datadog_api_client/configuration.rb#L585