Jens-G opened a new pull request, #3900:
URL: https://github.com/apache/thrift/pull/3900
The Static Code Analysis workflow has been red on master since `667952807`
("Encode the header
transport varint from an unsigned value"), which added
```ruby
io = StringIO.new(String.new)
```
to the varint spec. RuboCop flags it:
```
spec/header_transport_spec.rb:874:25: C: [Correctable]
Performance/UnfreezeString:
Use unary plus to get an unfrozen string literal.
```
The last green SCA run on master was `be3be9f69`; every run since, and every
open pull request,
fails on this one offense.
`rubocop -a` does not touch it — the correction is marked unsafe, and `-A`
produces
`StringIO.new((+''))`, which then trips two further cops. The reason it is
unsafe matters here:
`String.new` is ASCII-8BIT while `+""` is UTF-8, and this buffer receives
binary bytes.
`"".b` keeps the original semantics exactly — a new, unfrozen, empty
ASCII-8BIT string, the same
object shape `String.new` produces — and RuboCop accepts it.
Verified with the pinned linter versions from `Gemfile.linters` (rubocop
1.82.1,
rubocop-performance 1.26.1, rubocop-rspec 3.8.0): the CI invocation
`rubocop --config .rubocop.yml . ../../test/rb ../../tutorial/rb` reports
the single offense
before the change and `no offenses detected`, exit 0, after it.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]