Skip to content

fix: skip xliff schema 1.0 issue#25

Merged
konradmichalik merged 3 commits intomainfrom
xliff-schema-1.0
Jul 11, 2025
Merged

fix: skip xliff schema 1.0 issue#25
konradmichalik merged 3 commits intomainfrom
xliff-schema-1.0

Conversation

@konradmichalik
Copy link
Copy Markdown
Contributor

@konradmichalik konradmichalik commented Jul 10, 2025

Summary by CodeRabbit

  • Documentation

    • Updated the validator name in the documentation and help text from "SchemaValidator" to "XliffSchemaValidator".
  • Bug Fixes

    • Improved error handling for unsupported XLIFF versions, now logging a notice instead of an error when skipping unsupported files.
  • Tests

    • Updated all test references to use "XliffSchemaValidator" instead of "SchemaValidator".

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jul 10, 2025

Walkthrough

This change renames the SchemaValidator class to XliffSchemaValidator throughout the codebase, updates all references in documentation, help texts, registry, and tests, and enhances exception handling in the renamed validator. No changes are made to exported interfaces or the overall logic of validation.

Changes

File(s) Change Summary
README.md, src/Command/ValidateTranslationCommand.php Updated validator name from SchemaValidator to XliffSchemaValidator in documentation/help text.
src/Validator/ValidatorRegistry.php Replaced SchemaValidator::class with XliffSchemaValidator::class in available validators list.
src/Validator/XliffSchemaValidator.php Renamed class; improved exception handling for unsupported XLIFF versions.
tests/src/Validator/SchemaValidatorTest.php, ValidatorRegistryTest.php Updated all references from SchemaValidator to XliffSchemaValidator in tests.
tests/src/Fixtures/config/unsupported.txt Removed trailing newline character.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ValidateTranslationCommand
    participant ValidatorRegistry
    participant XliffSchemaValidator

    User->>ValidateTranslationCommand: Run validate-translations
    ValidateTranslationCommand->>ValidatorRegistry: getAvailableValidators()
    ValidatorRegistry-->>ValidateTranslationCommand: [XliffSchemaValidator, ...]
    ValidateTranslationCommand->>XliffSchemaValidator: processFile(file)
    XliffSchemaValidator-->>ValidateTranslationCommand: validation result/errors
Loading

Possibly related PRs

Poem

A validator once named Schema,
Now wears a new XLIFF diadem.
Through docs and tests, its name has changed,
Exception paths are rearranged.
Registry and help now match,
No more old names to dispatch!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

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

🧹 Nitpick comments (1)
tests/src/Validator/SchemaValidatorTest.php (1)

12-12: Consider renaming test class for consistency.

The test class name SchemaValidatorTest no longer matches the validator it's testing (XliffSchemaValidator). Consider renaming it to XliffSchemaValidatorTest for better clarity and consistency.

-final class SchemaValidatorTest extends TestCase
+final class XliffSchemaValidatorTest extends TestCase

Note: This would also require renaming the file from SchemaValidatorTest.php to XliffSchemaValidatorTest.php.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 07f16d2 and 0ef0d6b.

📒 Files selected for processing (7)
  • README.md (1 hunks)
  • src/Command/ValidateTranslationCommand.php (1 hunks)
  • src/Validator/ValidatorRegistry.php (1 hunks)
  • src/Validator/XliffSchemaValidator.php (2 hunks)
  • tests/src/Fixtures/config/unsupported.txt (1 hunks)
  • tests/src/Validator/SchemaValidatorTest.php (9 hunks)
  • tests/src/Validator/ValidatorRegistryTest.php (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
tests/src/Validator/ValidatorRegistryTest.php (1)
src/Validator/XliffSchemaValidator.php (1)
  • XliffSchemaValidator (13-86)
src/Validator/ValidatorRegistry.php (1)
src/Validator/XliffSchemaValidator.php (1)
  • XliffSchemaValidator (13-86)
src/Validator/XliffSchemaValidator.php (1)
src/Validator/AbstractValidator.php (1)
  • AbstractValidator (15-192)
🪛 GitHub Actions: CGL
tests/src/Fixtures/config/unsupported.txt

[error] 1-1: EditorConfigCLI: This file has no final new line.

🔇 Additional comments (10)
src/Command/ValidateTranslationCommand.php (1)

106-106: Documentation update looks good.

The help text correctly reflects the renamed validator class from SchemaValidator to XliffSchemaValidator.

README.md (1)

83-83: Documentation update correctly reflects the class renaming.

The validator table entry has been properly updated to use XliffSchemaValidator while preserving all other information.

tests/src/Validator/ValidatorRegistryTest.php (2)

10-10: Import statement correctly updated for renamed class.

The import statement properly references the renamed XliffSchemaValidator class.


21-21: Test assertion properly updated for renamed class.

The assertion correctly checks for XliffSchemaValidator::class in the available validators list.

src/Validator/ValidatorRegistry.php (1)

18-18: Registry correctly updated for renamed validator class.

The validator registry properly references XliffSchemaValidator::class instead of the old SchemaValidator::class, ensuring the renamed validator remains available.

src/Validator/XliffSchemaValidator.php (2)

13-13: LGTM: Class rename is consistent with PR objectives.

The class name change from SchemaValidator to XliffSchemaValidator provides better clarity about its specific purpose for XLIFF schema validation.


37-41: PHP Version Compatibility Confirmed: str_contains() Is Safe
Composer.json specifies PHP ^8.1, so str_contains() (added in PHP 8.0) is fully supported. No changes needed for backward compatibility.

  • composer.json → "php": "^8.1"
  • Multiple existing uses of str_contains() confirm it’s already relied upon.
tests/src/Validator/SchemaValidatorTest.php (3)

8-8: LGTM: Import statement correctly updated.

The import statement properly references the renamed XliffSchemaValidator class.


82-82: LGTM: All validator instantiations consistently updated.

All test methods properly instantiate the renamed XliffSchemaValidator class, ensuring the tests will continue to work correctly.

Also applies to: 94-94, 112-112, 121-121, 129-129, 157-157, 184-184, 219-219, 238-238


240-240: LGTM: Expected short name correctly updated.

The assertion properly expects XliffSchemaValidator as the short name, which is consistent with the class rename.

@konradmichalik konradmichalik merged commit 7d43169 into main Jul 11, 2025
22 of 24 checks passed
@konradmichalik konradmichalik deleted the xliff-schema-1.0 branch July 28, 2025 17:14
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