fix: file and overwrite parameters in the context commands#991
fix: file and overwrite parameters in the context commands#991andrii-bodnar merged 7 commits intomainfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #991 +/- ##
============================================
+ Coverage 65.29% 65.33% +0.05%
- Complexity 1763 1773 +10
============================================
Files 255 255
Lines 7285 7314 +29
Branches 1101 1109 +8
============================================
+ Hits 4756 4778 +22
- Misses 1890 1892 +2
- Partials 639 644 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fe089be to
c51babc
Compare
There was a problem hiding this comment.
Pull request overview
This pull request fixes file filtering to properly handle file paths containing literal square brackets (like [test.Folder dev]) versus glob character class patterns (like [a-z] or [0-9]). The fix distinguishes between these two cases by analyzing bracket content and escaping those that contain special characters like spaces and dots, while preserving valid character class patterns for glob matching.
Changes:
- Added bracket escaping logic in FileMatcher to distinguish literal brackets from glob character classes
- Updated path normalization in FileHelper.isPathMatch to ensure both paths and patterns start with a separator for consistent matching
- Added tests to verify the fix handles paths with literal brackets and character class patterns correctly
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/main/java/com/crowdin/cli/properties/helper/FileMatcher.java | Added escapeInvalidBrackets and isValidCharacterClass methods to intelligently escape square brackets that are not part of valid glob character class patterns |
| src/main/java/com/crowdin/cli/properties/helper/FileHelper.java | Updated isPathMatch to normalize both path and pattern with leading separators for consistent matching behavior |
| src/test/java/com/crowdin/cli/properties/helper/FileHelperTest.java | Added test cases to verify matching works with literal brackets and character class patterns, including cross-matching with/without leading slashes |
| src/test/java/com/crowdin/cli/commands/actions/ContextDownloadActionTest.java | Added comprehensive test case testJsonlSavesFileFilter2 to verify file filtering works with paths containing literal brackets like [test.Folder dev] |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/test/java/com/crowdin/cli/commands/actions/ContextDownloadActionTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/crowdin/cli/commands/actions/ContextDownloadActionTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/crowdin/cli/commands/actions/ContextDownloadActionTest.java
Outdated
Show resolved
Hide resolved
…ActionTest.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ActionTest.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ActionTest.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.