feat: enhance warning messages for strict mode in validation renderers#24
feat: enhance warning messages for strict mode in validation renderers#24konradmichalik merged 1 commit intomainfrom
Conversation
WalkthroughThe changes update how strict mode is handled when validation warnings occur, ensuring that warnings in strict mode are treated as failures with distinct messaging in both CLI and JSON renderers. Related test expectations and a test script are also updated to reflect this stricter behavior. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI/JSON Renderer
participant ValidationResult
User->>CLI/JSON Renderer: Run validation (with/without --strict)
CLI/JSON Renderer->>ValidationResult: Get result type (success/warning/error)
alt Result is warning and strict mode enabled
CLI/JSON Renderer->>User: Output "failed with warnings in strict mode"
else Result is warning and strict mode not enabled
CLI/JSON Renderer->>User: Output "completed with warnings"
else Result is success or error
CLI/JSON Renderer->>User: Output standard message
end
Possibly related PRs
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/composer.json (1)
29-29: Consider if this change belongs in this PR.The addition of
--dry-runto the test script appears unrelated to the PR objectives of enhancing strict mode warning messages. This might be better suited for a separate commit or PR.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/Result/ValidationResultCliRenderer.php(2 hunks)src/Result/ValidationResultJsonRenderer.php(1 hunks)tests/composer.json(1 hunks)tests/src/Result/ValidationResultJsonRendererTest.php(1 hunks)
🔇 Additional comments (5)
src/Result/ValidationResultJsonRenderer.php (1)
51-51: LGTM! Proper strict mode warning handling added.The new condition correctly treats warnings as failures in strict mode with clear messaging. The placement before the regular warning condition ensures proper precedence.
tests/src/Result/ValidationResultJsonRendererTest.php (1)
141-141: LGTM! Test updated to match new strict mode behavior.The expected message correctly reflects the new behavior where warnings are treated as failures in strict mode.
src/Result/ValidationResultCliRenderer.php (3)
263-263: LGTM! Consistent strict mode message handling.The strict mode warning condition matches the JSON renderer implementation, ensuring consistent messaging across output formats.
272-272: LGTM! Proper hint logic for strict mode.The condition correctly prevents showing the "--strict" hint when already in strict mode, avoiding redundant messaging.
277-281: LGTM! Appropriate styling for strict mode warnings.The styling logic correctly treats warnings as errors in strict mode:
- Line 277: Excludes strict mode from yellow text styling
- Line 281: Uses error styling for strict mode warnings instead of warning styling
This ensures visual consistency with the failure semantics of strict mode.
Summary by CodeRabbit
New Features
Bug Fixes
Tests