Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughAdds exported StripSpaces(s string) to remove all Unicode whitespace from strings; includes unit tests, example tests, benchmarks, and updates CI to test newer Go versions and run benchmarks. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #73 +/- ##
==========================================
+ Coverage 36.11% 40.25% +4.14%
==========================================
Files 2 2
Lines 72 77 +5
==========================================
+ Hits 26 31 +5
Misses 46 46 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@example_test.go`:
- Around line 8-10: The import block is misordered for the gci formatter: move
the external package import "github.com/google/shlex" into the
external/third-party section so it appears before the local module import
"al.essio.dev/pkg/shellescape"; update the imports in the file's import list so
standard library imports remain first, then external imports (including
github.com/google/shlex), then local imports (al.essio.dev/pkg/shellescape) to
satisfy the gci grouping.
In `@shellescape_test.go`:
- Around line 206-223: BenchmarkScanTokensLargeData consumes the bytes.Buffer on
the first iteration so subsequent iterations see empty input; fix by creating a
fresh reader each iteration (e.g., precompute joined := bytes.Join(data,
[]byte{'\x00'}) and inside the loop recreate buf/newReader from joined) and use
that new reader when constructing bufio.NewScanner(scanner) so
scanner.Split(shellescape.ScanTokens) runs over the full data every benchmark
iteration; update references to buf creation in BenchmarkScanTokensLargeData and
ensure scanner.Err() check remains after scanning.
- Around line 163-177: BenchmarkScanTokens uses a single bytes.Buffer `buf`
created once (via bytes.NewBuffer(bytes.Join(...))) which is consumed by
bufio.NewScanner on the first iteration, so later iterations scan an empty
buffer; fix by moving the buffer creation into the loop (recreate `buf` each
iteration before calling bufio.NewScanner) or by creating the joined byte slice
once and calling bytes.NewBuffer(joined) inside the loop so `scanner :=
bufio.NewScanner(buf)` always sees a fresh buffer when using
shellescape.ScanTokens.
- Around line 110-117: Replace the underscored loop variable `tt_` to follow Go
naming conventions and remove the unnecessary capture for Go 1.22+ (or use a
properly named capture for older Go). Specifically, change the range variable
used in the loop over `tests` from `tt_` to a conventional name like `tt` (or
`tc`/`testCase`) and update the body to directly use that variable in the
`t.Run` subtest that calls `shellescape.StripSpaces` and `assertEqual`; if you
must support pre-1.22 loop-capture behavior, keep an explicit capture but use a
valid name (e.g., `tc := tt`) instead of `tt_`.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 51dc6aa7-d8e6-409f-955b-defff8f8e02f
📒 Files selected for processing (3)
example_test.goshellescape.goshellescape_test.go
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/build.yaml:
- Around line 28-29: The Benchmark workflow step currently re-runs unit tests
and targets a single test file; change the command invoked by the "Benchmark"
step so it adds the `-run=^$` flag to avoid running regular tests and use a
package-wide target instead of a single file (replace `shellescape_test.go` with
`./...`), i.e. run `go test -run=^$ -bench=. -benchmem ./...` from the Benchmark
step to only execute benchmarks across all packages.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 8a968a7b-3a00-4d3d-8d5c-839683f657dd
📒 Files selected for processing (1)
.github/workflows/build.yaml
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Summary by CodeRabbit
New Features
Tests
Chores