Skip to content

feat: add --exclude option to validate-translations command#79

Merged
konradmichalik merged 3 commits intomainfrom
cli-option-exclude
Oct 27, 2025
Merged

feat: add --exclude option to validate-translations command#79
konradmichalik merged 3 commits intomainfrom
cli-option-exclude

Conversation

@konradmichalik
Copy link
Copy Markdown
Contributor

@konradmichalik konradmichalik commented Oct 27, 2025

Summary by CodeRabbit

  • New Features

    • Added --exclude (-e) option to the validate-translations command to specify comma-separated glob patterns for excluding files; CLI exclusions are applied alongside existing configuration.
  • Documentation

    • Updated command help and examples to show the new exclude option and usage.
  • Tests

    • Added tests covering single, multiple, and short-form exclude option usage.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Oct 27, 2025

Walkthrough

Added a new CLI option --exclude (-e) to the validate-translations command that accepts comma-separated glob patterns; CLI parsing merges these patterns with configuration-based excludes and applies them during file detection. Documentation and tests were added/updated to cover the option.

Changes

Cohort / File(s) Change Summary
Documentation
docs/console-command.md
Documented the new --exclude (-e) option in usage and the options table.
Command Implementation
src/Command/ValidateTranslationCommand.php
Added --exclude/-e option, parsing of comma-separated glob patterns, merging of CLI patterns with config excludes, and applied excludes during file discovery; updated help/examples.
Tests
tests/src/Command/ValidateTranslationCommandTest.php
Added three tests: testExecuteWithExcludeOption, testExecuteWithMultipleExcludePatterns, and testExecuteWithExcludeShortOption to verify single, multiple (comma-separated), and short-form exclude usage.

Sequence Diagram(s)

sequenceDiagram
  participant User as User (CLI)
  participant Cmd as ValidateTranslationCommand
  participant Conf as Config (excludes)
  participant Detector as FileDetector

  User->>Cmd: invoke validate-translations --exclude "pattern1,pattern2" --dry-run
  Cmd->>Conf: read configured excludes
  Cmd->>Cmd: parse CLI comma-separated excludes
  Cmd->>Conf: merge CLI excludes with configured excludes
  Cmd->>Detector: detect files (apply merged excludes)
  Detector-->>Cmd: file list
  Cmd-->>User: validation output (status)
  note right of Cmd #DDEBF7: New/changed interaction: CLI parsing & merge of excludes
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify parsing handles trimming, empty segments, and trailing commas.
  • Confirm merge semantics (CLI patterns are appended vs. replaced) match intended behavior.
  • Review tests to ensure they assert behavior accurately and cover multiple edge cases.

Possibly related PRs

Poem

🐰 I nibble commas, patterns I sow,
-e in my paws, off the unwanted go,
Files hop away from my careful detective eye,
Clean translations remain beneath the sky,
Hooray — exclude and validate, rabbit-approved! 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "feat: add --exclude option to validate-translations command" directly and accurately summarizes the primary change in the changeset. The title is concise, clear, and specific—it immediately conveys that a new CLI option has been added to the validate-translations command. A teammate scanning the commit history would understand exactly what was accomplished. The changes across all modified files (documentation, implementation, and tests) all center on adding and documenting this new option, making the title fully aligned with the main objective of the pull request.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cli-option-exclude

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e78fb41 and bb70586.

📒 Files selected for processing (1)
  • src/Command/ValidateTranslationCommand.php (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/Command/ValidateTranslationCommand.php
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Report test coverage

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/src/Command/ValidateTranslationCommandTest.php (1)

313-368: Consider verifying actual file exclusion behavior.

The tests confirm the command accepts the --exclude option without errors, but they don't verify that files matching the patterns are actually excluded from validation. The patterns used (**/nonexistent/**, **/backup/**, **/temp/**) don't match any files in the test fixtures.

Consider adding a test that:

  1. Uses a fixture directory with files that should be excluded
  2. Passes a pattern that matches those files
  3. Verifies the excluded files don't appear in validation results or output

This would provide stronger confidence that the exclusion logic works correctly end-to-end.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a94ee6a and e78fb41.

📒 Files selected for processing (3)
  • docs/console-command.md (2 hunks)
  • src/Command/ValidateTranslationCommand.php (3 hunks)
  • tests/src/Command/ValidateTranslationCommandTest.php (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
tests/src/Command/ValidateTranslationCommandTest.php (1)
src/Command/ValidateTranslationCommand.php (2)
  • ValidateTranslationCommand (37-275)
  • execute (169-245)
src/Command/ValidateTranslationCommand.php (1)
src/Config/TranslationValidatorConfig.php (1)
  • getExclude (216-219)
🔇 Additional comments (3)
docs/console-command.md (1)

4-4: LGTM!

The documentation is clear, consistent with other options, and accurately reflects the implementation.

Also applies to: 14-14

src/Command/ValidateTranslationCommand.php (2)

102-107: LGTM!

The option configuration and help text are well-structured and provide clear guidance to users.

Also applies to: 123-123


179-186: Implementation looks solid.

The merge logic correctly combines configuration-based exclude patterns with CLI-provided patterns. The approach is straightforward and maintainable.

@konradmichalik konradmichalik merged commit b00b7b3 into main Oct 27, 2025
28 checks passed
@konradmichalik konradmichalik deleted the cli-option-exclude branch October 27, 2025 08:46
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