Skip to content

docs: improve documentation#51

Merged
konradmichalik merged 9 commits intomainfrom
improve-documentation
Jul 28, 2025
Merged

docs: improve documentation#51
konradmichalik merged 9 commits intomainfrom
improve-documentation

Conversation

@konradmichalik
Copy link
Copy Markdown
Contributor

@konradmichalik konradmichalik commented Jul 28, 2025

Summary by CodeRabbit

  • Documentation
    • Updated contributing instructions to correct repository name and directory references.
    • Simplified README by linking to external command documentation and streamlining validator information.
    • Added a new page detailing console command usage and options.
    • Corrected configuration documentation links and updated validator class references in examples.
    • Standardized configuration key naming in file detector documentation.
    • Improved validator documentation with clearer formatting, detailed configuration guidance, and enhanced tips and notes.
    • Removed validator-specific configuration documentation file.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jul 28, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update revises and enhances documentation across multiple files. It corrects repository naming in contribution instructions, streamlines the README, updates configuration and validator documentation for clarity and accuracy, introduces a new console command usage guide, and adjusts configuration key naming conventions for consistency.

Changes

Cohort / File(s) Change Summary
Contribution Instructions Update
CONTRIBUTING.md
Corrected repository clone URL and directory name from "composer-translation-validation" to "composer-translation-validator" in setup instructions.
README Simplification
README.md
Removed detailed command-line usage and options table, referencing external documentation instead. Streamlined the translation validators table by removing the result/severity column.
Configuration Documentation Corrections
docs/config-file.md
Fixed relative link to schema documentation. Replaced all references to SchemaValidator with XliffSchemaValidator in examples and validator lists.
Console Command Documentation Addition
docs/console-command.md
Added a new file detailing usage, arguments, and options for the validate-translations console command, including syntax, flags, and important notes about required arguments or configuration.
File Detector Key Naming Update
docs/file-detector.md
Changed configuration example keys from file_detectors (underscore) to file-detectors (hyphen) in YAML and JSON snippets for consistency.
Validator Documentation Overhaul
docs/validators.md
Major rewrite for clarity and formatting: removed "Quick Testing" section, gave each validator a dedicated heading with links, replaced result statuses with badges, added callout blocks for tips and warnings, expanded KeyNamingConventionValidator section with supported conventions and configuration, and standardized example commands and formatting.
Validator Configuration Documentation Removal
docs/validator-configuration.md
Deleted detailed validator configuration documentation, including examples and developer guidance on custom validator config, consolidating configuration details into other documentation.

Sequence Diagram(s)

Not applicable: All changes are documentation-only and do not alter or introduce control flow.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

In docs we hop, from page to page,
Tidying names, we set the stage.
Hyphens here and badges there,
Clearer guides for all to share.
With every leap, our docs grow bright—
A rabbit’s work, done just right! 🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 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 7f841f7 and a159977.

📒 Files selected for processing (1)
  • docs/validators.md (15 hunks)
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch improve-documentation

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 3

🧹 Nitpick comments (6)
README.md (1)

42-42: Relative link works, but consider forward-compatibility.

docs/console-command.md is correct today, yet if the README is ever rendered inside the docs folder (e.g. a docs site generator), the link will break. Using an absolute GitHub URL or ./docs/console-command.md avoids that edge case.

docs/console-command.md (1)

13-14: Minor grammar / punctuation.

Missing period at the end of the description and “sub-directories” could be clearer.

-| `--recursive`     | `-r`     | Search for translation files recursively in subdirectories
+| `--recursive`     | `-r`     | Searches for translation files recursively in sub-directories. |
docs/validators.md (4)

228-230: Remove duplicated heading text.

HtmlTagValidator is repeated in the heading (## [...]HtmlTagValidator).
It renders oddly and breaks anchor generation in most Markdown engines.

-## [`HtmlTagValidator`](../src/Validator/HtmlTagValidator.php)HtmlTagValidator
+## [`HtmlTagValidator`](../src/Validator/HtmlTagValidator.php)

158-160: Grammar: “a whitespace” not “an whitespace”.

-    - Warning the translation key `contact` has an whitespace only value
+    - Warning the translation key `contact` has a whitespace-only value

285-287: Minor wording tweak for subject–verb agreement.

-If not configured, it try to detect the most common pattern …
+If not configured, it tries to detect the most common pattern …

340-350: YAML example overrides custom_pattern three times.

YAML only keeps the last key, so earlier regex examples are silently discarded. Use a list instead to avoid misleading readers:

validator-settings:
  KeyNamingConventionValidator:
    custom_pattern:
      - '/^[a-z0-9]+$/'
      - '/^app\.[a-z][a-z0-9_]*$/'
      - '/^[a-z][a-z0-9_]{0,29}$/'   # Max 30 characters
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9986cf8 and b89b621.

📒 Files selected for processing (6)
  • CONTRIBUTING.md (1 hunks)
  • README.md (2 hunks)
  • docs/config-file.md (5 hunks)
  • docs/console-command.md (1 hunks)
  • docs/file-detector.md (1 hunks)
  • docs/validators.md (17 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
docs/config-file.md (2)
src/Validator/XliffSchemaValidator.php (1)
  • XliffSchemaValidator (33-106)
tests/src/Validator/SchemaValidatorTest.php (3)
  • SchemaValidatorTest (32-393)
  • testProcessFileWithValidXliff (100-112)
  • testProcessFileWithInvalidXliff (114-126)
🪛 LanguageTool
docs/validators.md

[style] ~541-~541: Using many exclamation marks might seem excessive (in this case: 11 exclamation marks for a text that’s 5994 characters long)
Context: ...with schema violations.

> [!IMPORTANT] > Malformed XLIFF files can c...

(EN_EXCESSIVE_EXCLAMATION)

🔇 Additional comments (2)
CONTRIBUTING.md (1)

14-16: Repository URL & directory name look correct – no further action needed.

The corrected clone URL and directory name now match the actual repository. Nice catch!

docs/config-file.md (1)

59-60: Class reference rename is consistent – good update.

All JSON/YAML examples now reference XliffSchemaValidator, matching the actual class name.
No issues spotted.

Also applies to: 68-69

Comment on lines +243 to 246
file-detectors:
- "MoveElevator\\ComposerTranslationValidator\\FileDetector\\DirectoryFileDetector"
- "MoveElevator\\ComposerTranslationValidator\\FileDetector\\SuffixFileDetector"
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify implementation supports new file-detectors key (hyphen) before publishing docs.

The docs switch from file_detectorsfile-detectors.
If the PHP config loader still expects the underscore variant, users’ configs will break silently.

Update the loader to accept both forms or add a deprecation note.

Also applies to: 251-254


🏁 Script executed:

# Suggested quick sanity-check
rg --ignore-case --pretty "file_detectors" src | head

Length of output: 53


To get a clearer picture of how the config loader handles the file-detectors key, let’s search for any references to both the hyphenated and underscored variants, plus how the plugin reads its config:


🏁 Script executed:

#!/bin/bash
echo "🔍 Searching for any ‘file_detectors’ usage across the repo"
rg -n "file_detectors"

echo "🔍 Searching for any ‘file-detectors’ usage across the repo"
rg -n "file-detectors"

echo "🔍 Inspecting how the plugin reads its extra config"
rg -n "getExtra" -C2 src

echo "🔍 Locating the PluginInterface implementation"
rg -n "PluginInterface" -C2 src

echo "🔍 Checking for Symfony Config TreeBuilder usage"
rg -n "TreeBuilder" -C2 src

echo "🔍 Looking specifically for arrayNode definitions of file detectors"
rg -n "arrayNode('file-detectors')" -C2 src
rg -n "arrayNode('file_detectors')" -C2 src

Length of output: 3174


Config loader only recognizes file-detectors (hyphen)

The codebase currently only supports the hyphenated key, so any existing configs using file_detectors (underscore) will break silently. Please choose one of the following:

  • Alias the old key
    • In src/Config/ConfigValidator.php (around lines 43–44) accept file_detectors as a fallback to file-detectors
    • In src/Config/ConfigFactory.php (around line 63) map both variants to setFileDetectors()
    • Update schema/translation-validator.schema.json (around line 31) to recognize file_detectors (with a deprecation message)
    • Add tests in tests/src/Fixtures/config and ConfigFactoryTest/ConfigValidatorTest to cover the underscore variant

  • Document a breaking change
    • In docs/upgrade.md or the changelog, note removal of file_detectors in favor of file-detectors
    • Throw a clear exception in ConfigValidator if file_detectors is used, guiding users to the new key

Affected files to update:

  • src/Config/ConfigValidator.php
  • src/Config/ConfigFactory.php
  • schema/translation-validator.schema.json
  • tests/src/Fixtures/config/…
  • docs/file-detector.md (243–246, 251–254)
  • docs/config-file.md (61, 97)
🤖 Prompt for AI Agents
In docs/file-detector.md around lines 243 to 246, the config example uses the
hyphenated key `file-detectors` which is the only supported key currently. To
fix the silent breakage for configs using the underscore variant
`file_detectors`, either implement an alias fallback in
src/Config/ConfigValidator.php (lines 43-44) and src/Config/ConfigFactory.php
(around line 63) to accept both keys, update the JSON schema
(translation-validator.schema.json around line 31) to recognize `file_detectors`
with a deprecation warning, and add tests for the underscore variant; or
alternatively document the breaking change in docs/upgrade.md or changelog and
throw a clear exception in ConfigValidator if `file_detectors` is used. Also
update related docs at docs/file-detector.md (lines 243-246 and 251-254) and
docs/config-file.md (lines 61 and 97) accordingly.

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: 1

♻️ Duplicate comments (1)
docs/validators.md (1)

126-128: Malformed fenced-code block still breaks rendering

The closing delimiter has four back-ticks instead of three, so everything afterwards is rendered as code. Same issue was raised previously.

-```bash
-composer validate-translations ./translations --skip "MoveElevator\\ComposerTranslationValidator\\Validator\\DuplicateValuesValidator"
-````
+```bash
+composer validate-translations ./translations --skip "MoveElevator\\ComposerTranslationValidator\\Validator\\DuplicateValuesValidator"
+```
🧹 Nitpick comments (2)
docs/validators.md (2)

321-324: Incorrect heading & missing fenced-code language

  1. ### #Console Output has an extra #.
  2. The following code block lacks a language tag, triggering MD040.
-### #Console Output
-```
+#### Console Output
+```text

298-300: Minor grammar fix – “it try” → “it tries”.

-If not configured, it try to detect the most common pattern used in your files and warns about inconsistencies.
+If not configured, it tries to detect the most common pattern used in your files and warns about inconsistencies.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b89b621 and 802d2a6.

📒 Files selected for processing (1)
  • docs/validators.md (15 hunks)
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
docs/validators.md

9-9: Link fragments should be valid

(MD051, link-fragments)


214-214: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


322-322: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


528-528: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🪛 LanguageTool
docs/validators.md

[style] ~554-~554: Using many exclamation marks might seem excessive (in this case: 12 exclamation marks for a text that’s 6722 characters long)
Context: ...with schema violations.

> [!IMPORTANT] > Malformed XLIFF files can c...

(EN_EXCESSIVE_EXCLAMATION)

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: 2

♻️ Duplicate comments (2)
docs/file-detector.md (2)

241-246: Reminder: config key rename may still be a breaking change

The docs exclusively use file-detectors: (hyphen). Unless the PHP config loader now aliases the former file_detectors key, existing user configs will break silently – this was already raised in a previous review.

Please either:

  1. add backward-compatibility in the loader (file_detectorsfile-detectors), or
  2. highlight this as a breaking change in the upgrade guide and throw a clear exception if the old key is encountered.

251-254: Same concern for JSON snippet

Same as above – ensure code supports both keys or document the breaking change.

🧹 Nitpick comments (3)
docs/validators.md (3)

15-18: Grammar & redundancy in IMPORTANT call-out

“Others validators return just return a warning” – duplicated verb and wrong plural.

- - ![Warning](... ) Others validators return just return a warning. Therefore, just a warning indicates that the validation succeeded, but there are potential issues that should be addressed.
+ - ![warning](... ) Other validators only return a warning. A warning indicates that the validation succeeded, but there are potential issues that should be addressed.

213-218: Add language hint to console output blocks (MD040)

Markdown-lint flags these fenced blocks because no language is specified.
Use text (or console) to silence the warning and improve rendering.

-```
+```text

Repeat for similar blocks below.


533-540: Missing language spec on fenced block (MD040)

Add text to the opening backticks of this console output to satisfy linter and provide syntax highlighting.

-```
+```text
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 802d2a6 and 97411f0.

📒 Files selected for processing (4)
  • README.md (2 hunks)
  • docs/file-detector.md (7 hunks)
  • docs/validator-configuration.md (0 hunks)
  • docs/validators.md (15 hunks)
💤 Files with no reviewable changes (1)
  • docs/validator-configuration.md
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
README.md

19-19: Link fragments should be valid

(MD051, link-fragments)

docs/validators.md

214-214: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


322-322: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


535-535: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🪛 LanguageTool
docs/validators.md

[style] ~561-~561: Using many exclamation marks might seem excessive (in this case: 12 exclamation marks for a text that’s 6713 characters long)
Context: ...with schema violations.

> [!IMPORTANT] > Malformed XLIFF files can c...

(EN_EXCESSIVE_EXCLAMATION)

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: 1

🧹 Nitpick comments (3)
docs/validators.md (3)

50-59: Add a language identifier to console-output blocks

markdownlint flags these fences (MD040). Adding bash or console avoids the warning and enables syntax highlighting.

Example fix:

-```
+```bash
 # console output …

Do this for all four blocks highlighted above.  



Also applies to: 214-222, 321-331, 535-545

---

`299-300`: **Minor grammar tweak** — “it tries”  

```diff
-If not configured, it try to detect the most common pattern
+If not configured, it tries to detect the most common pattern

173-174: Article & hyphenation

-    - Warning the translation key `contact` has an whitespace only value
+    - Warning the translation key `contact` has a whitespace-only value
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 97411f0 and 7f841f7.

📒 Files selected for processing (3)
  • README.md (2 hunks)
  • docs/console-command.md (1 hunks)
  • docs/validators.md (15 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/console-command.md
  • README.md
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
docs/validators.md

214-214: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


322-322: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


535-535: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🪛 LanguageTool
docs/validators.md

[style] ~561-~561: Using many exclamation marks might seem excessive (in this case: 12 exclamation marks for a text that’s 6712 characters long)
Context: ...with schema violations.

> [!IMPORTANT] > Malformed XLIFF files can c...

(EN_EXCESSIVE_EXCLAMATION)

@konradmichalik konradmichalik merged commit d1de972 into main Jul 28, 2025
25 of 26 checks passed
@konradmichalik konradmichalik deleted the improve-documentation branch July 28, 2025 17:13
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