Skip to content

Update configuration for frozen-string-literal#1971

Merged
jack-edmonds-dd merged 2 commits intoDataDog:masterfrom
HParker:update-for-frozen-string-literal
Oct 1, 2024
Merged

Update configuration for frozen-string-literal#1971
jack-edmonds-dd merged 2 commits intoDataDog:masterfrom
HParker:update-for-frozen-string-literal

Conversation

@HParker
Copy link
Copy Markdown
Contributor

@HParker HParker commented Aug 20, 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.

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

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.
@HParker HParker requested a review from a team as a code owner August 20, 2024 19:15
@github-actions
Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had activity in the last 30 days.
If there is no activity for another 90 days, this issue will be automatically closed.

@github-actions github-actions bot added the stale label Sep 20, 2024
@HParker
Copy link
Copy Markdown
Contributor Author

HParker commented Sep 20, 2024

Please say open ❤️

@github-actions github-actions bot removed the stale label Sep 21, 2024
@jack-edmonds-dd
Copy link
Copy Markdown
Contributor

Merging since CI checks passed in #2037

@jack-edmonds-dd jack-edmonds-dd merged commit f3b30c6 into DataDog:master Oct 1, 2024
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
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants