Skip to content

feat: skip DuplicateValuesValidator by default#74

Merged
konradmichalik merged 1 commit intomainfrom
disable-duplicate-values-validator
Oct 27, 2025
Merged

feat: skip DuplicateValuesValidator by default#74
konradmichalik merged 1 commit intomainfrom
disable-duplicate-values-validator

Conversation

@konradmichalik
Copy link
Copy Markdown
Contributor

@konradmichalik konradmichalik commented Oct 16, 2025

Note

The DuplicateValuesValidator is skipped by default to reduce noise in validation results.
It can enable by explicitly including it in the only option or by setting an empty skip array.

Summary by CodeRabbit

  • Documentation

    • Updated documentation explaining that the duplicate values validator is disabled by default, including comprehensive enablement instructions and configuration examples.
  • Chores

    • The duplicate values validator is now disabled by default and must be explicitly enabled in your configuration if this validation is required.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Oct 16, 2025

Walkthrough

The DuplicateValuesValidator is now disabled by default (opt-in). Changes include adding it to the default skip configuration, updating all affected tests to reflect the new default behavior, and documenting the opt-in mechanism with configuration examples across multiple formats.

Changes

Cohort / File(s) Summary
Documentation
docs/config-file.md, docs/validators.md
Added documentation explaining DuplicateValuesValidator is disabled by default with enablement instructions via configuration (JSON, YAML, PHP, composer.json). Replaced skip-focused examples with updated guidance emphasizing opt-in behavior.
Core Configuration
src/Config/TranslationValidatorConfig.php
Imported DuplicateValuesValidator and changed default skip property to include DuplicateValuesValidator::class instead of empty array.
Command Help Text
src/Command/ValidateTranslationCommand.php
Updated validator description to indicate DuplicateValuesValidator is "opt-in, disabled by default".
Test Expectations
tests/src/Config/ConfigFactoryTest.php, tests/src/Config/TranslationValidatorConfigTest.php
Updated test expectations to reflect new default skip configuration containing DuplicateValuesValidator::class as the initial element in the skip list.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

The changes are straightforward configuration and documentation updates, but affect multiple test files with coordinated expectation changes. Logic is simple, but the distributed scope across tests requires verification that all expectations align with the new default behavior.

Possibly related PRs

Poem

🐰 A validator once eager and keen,
Now rests by default, serene and unseen,
Until summoned by config with care,
It springs to life—duplicate snares beware! ✨

Pre-merge checks and finishing touches

❌ 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%. 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 title accurately reflects the core change by stating that the DuplicateValuesValidator is now skipped by default, which directly matches the configuration update, accompanying documentation, and test adjustments. It is concise, clear, and gives any reviewer immediate insight into the primary purpose 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 disable-duplicate-values-validator

📜 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 fdf220a and bc46080.

📒 Files selected for processing (6)
  • docs/config-file.md (4 hunks)
  • docs/validators.md (2 hunks)
  • src/Command/ValidateTranslationCommand.php (1 hunks)
  • src/Config/TranslationValidatorConfig.php (2 hunks)
  • tests/src/Config/ConfigFactoryTest.php (1 hunks)
  • tests/src/Config/TranslationValidatorConfigTest.php (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
tests/src/Config/ConfigFactoryTest.php (2)
src/Validator/DuplicateValuesValidator.php (1)
  • DuplicateValuesValidator (29-117)
src/Config/TranslationValidatorConfig.php (1)
  • getSkip (198-201)
src/Config/TranslationValidatorConfig.php (1)
src/Validator/DuplicateValuesValidator.php (1)
  • DuplicateValuesValidator (29-117)
tests/src/Config/TranslationValidatorConfigTest.php (2)
src/Validator/DuplicateValuesValidator.php (1)
  • DuplicateValuesValidator (29-117)
src/Config/TranslationValidatorConfig.php (1)
  • getSkip (198-201)
🪛 LanguageTool
docs/config-file.md

[grammar] ~11-~11: There might be a mistake here.
Context: ...on) section for more details. > [!NOTE] > **DuplicateValuesValidator is disabled...

(QB_NEW_EN)

docs/validators.md

[grammar] ~88-~88: There might be a mistake here.
Context: ...elds.io/badge/WARNING-yellow) > [!NOTE] > This validator is disabled by default ...

(QB_NEW_EN)

🔇 Additional comments (8)
src/Config/TranslationValidatorConfig.php (1)

16-16: LGTM! Clean implementation of opt-in behavior.

The import and default skip configuration correctly implement the opt-in behavior for DuplicateValuesValidator. The implementation allows users to:

  • Enable it via setOnly([DuplicateValuesValidator::class])
  • Enable it via setSkip([]) to clear the default skip list
  • Keep the default behavior where it's skipped

Also applies to: 42-44

src/Command/ValidateTranslationCommand.php (1)

123-123: LGTM! Clear and concise help text.

The updated help text accurately describes the opt-in nature of the validator, making it clear to users that this validator is disabled by default.

tests/src/Config/ConfigFactoryTest.php (1)

76-76: LGTM! Test correctly reflects new default behavior.

The test expectation properly validates that the default skip configuration includes DuplicateValuesValidator::class when creating a config with minimal data.

docs/config-file.md (2)

11-15: LGTM! Clear note about opt-in behavior.

The note clearly explains that DuplicateValuesValidator is disabled by default and provides guidance on how to enable it. This will help users understand the new default behavior.


51-80: LGTM! Comprehensive enablement examples across all formats.

The documentation provides clear, actionable examples for enabling DuplicateValuesValidator in PHP, JSON, and YAML configurations. The dual approach (using only or clearing skip) gives users flexibility in how they enable the validator.

Also applies to: 119-139, 176-193

tests/src/Config/TranslationValidatorConfigTest.php (2)

109-109: LGTM! Test correctly validates append behavior.

The test properly verifies that calling skip() appends to the default skip list rather than replacing it, ensuring both DuplicateValuesValidator::class and the new validator are present.


167-167: LGTM! Default value tests correctly updated.

Both test methods properly validate that the default skip configuration includes DuplicateValuesValidator::class, ensuring consistency between getSkip() and toArray() outputs.

Also applies to: 267-267

docs/validators.md (1)

88-107: LGTM! Clear opt-in documentation with practical examples.

The documentation effectively explains:

  • Why the validator is disabled by default (reduces noise)
  • That duplicate values can be intentional
  • How to enable it via CLI or configuration

The examples are practical and easy to follow.


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.

@konradmichalik konradmichalik merged commit 55736ef into main Oct 27, 2025
28 checks passed
@konradmichalik konradmichalik deleted the disable-duplicate-values-validator 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