Trim whitespace from --include/--exclude patterns#238
Conversation
PISTA_INCLUDE/PISTA_EXCLUDE values are normalized in FilterOptions.AfterApply so leading/trailing whitespace around each pattern is stripped. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR improves CLI filter reliability by trimming leading/trailing whitespace from --include / --exclude patterns during FilterOptions.AfterApply, preventing common env-var multi-value parsing artifacts (e.g., " posts" entries) from silently failing to match object names.
Changes:
- Trim whitespace on each
FilterOptions.Include/Excludeentry before pattern validation. - Add a unit test covering trimming of spaces, tabs, and newlines for both include/exclude.
- Document the behavior change in
CHANGELOG.mdas1.10.5.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| options.go | Trims Include/Exclude patterns via strings.TrimSpace before validating patterns. |
| filter_test.go | Adds coverage ensuring AfterApply normalizes whitespace in include/exclude slices. |
| CHANGELOG.md | Adds release note describing why trimming is necessary and how it affects matching/validation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #238 +/- ##
=======================================
Coverage 91.94% 91.95%
=======================================
Files 50 50
Lines 5425 5429 +4
=======================================
+ Hits 4988 4992 +4
Misses 230 230
Partials 207 207
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
FilterOptions.AfterApplynowstrings.TrimSpacees eachInclude/Excludeentry before validation, so multi-value env vars likePISTA_INCLUDE="user*, posts"(kong parses to["user*", " posts"]) no longer silently fail to match.TestFilterOptions_AfterApply_TrimsWhitespacecovering spaces, tabs, and newlines on both fields.CHANGELOG.md.Test plan
go test ./...(filter unit tests)make vetmake lint