Skip to content

fix: preserve negation prefix when resolving config patterns#200

Open
geeee wants to merge 1 commit intotolgee:mainfrom
geeee:fix/negation-pattern-resolution
Open

fix: preserve negation prefix when resolving config patterns#200
geeee wants to merge 1 commit intotolgee:mainfrom
geeee:fix/negation-pattern-resolution

Conversation

@geeee
Copy link

@geeee geeee commented Mar 9, 2026

Negation glob patterns (e.g. !./src/excluded.tsx) in .tolgeerc config were broken - resolve() included the ! as part of the path, producing /abs/path/!./src/excluded.tsx instead of !/abs/path/src/excluded.tsx

Summary by CodeRabbit

  • New Features
    • Negation pattern support: Configuration patterns now support the "!" prefix to exclude specific files from matching. This provides users with enhanced granular control over pattern matching behavior, enabling them to define comprehensive patterns while easily excluding specific files that should not be matched or processed.

@coderabbitai
Copy link

coderabbitai bot commented Mar 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4f85e9c3-87eb-4b1d-90b4-62822ebc3235

📥 Commits

Reviewing files that changed from the base of the PR and between c1652fc and 966399c.

📒 Files selected for processing (3)
  • src/config/tolgeerc.ts
  • test/__fixtures__/validTolgeeRc/withNegationPattern.json
  • test/unit/config.test.ts

Walkthrough

The pull request adds support for negated patterns in Tolgee configuration files. When patterns prefixed with "!" are encountered, the leading negation character is now detected and preserved through the path resolution process, enabling exclusion patterns to function correctly alongside inclusion patterns.

Changes

Cohort / File(s) Summary
Negation Pattern Support
src/config/tolgeerc.ts, test/__fixtures__/validTolgeerc/withNegationPattern.json, test/unit/config.test.ts
Adds detection and preservation of negation prefixes ("!") in Tolgee patterns. Pattern strings are checked for leading "!", resolved to absolute paths, then reconstructed with the negation prefix if present. Includes a test fixture demonstrating negation patterns and unit tests verifying the behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A pattern with a bang, we now embrace,
Negation marks find their rightful place!
Exclusions hop, inclusions stay,
The config dances in a brighter way! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing negation prefix preservation when resolving config patterns, which aligns with the core issue and all changes in the PR.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant