fix #1707: совместимость и обработка ошибок в ЗаписатьТипДокумента +тесты#1708
fix #1707: совместимость и обработка ошибок в ЗаписатьТипДокумента +тесты#1708Mr-Rm wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughXmlWriterImpl.WriteDocumentType now validates its inputs, routes to the appropriate write overload, and converts writer exceptions into runtime exceptions using new factory methods. tests/xmlwrite.os adds four exported acceptance tests for successful and failing WriteDocumentType calls. ChangesWriteDocumentType refactor and tests
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/OneScript.StandardLibrary/Xml/XmlWriterImpl.cs (1)
526-540: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider narrowing factory method visibility.
WrongOrderException()andNoSystemIdException()arepublic staticbut only appear to be used internally byWriteDocumentType. No[ContextMethod]attribute exposes them to scripts, and no other file in the provided context references them. Making themprivate staticwould reduce the public API surface without any behavior change.♻️ Proposed visibility change
- public static RuntimeException WrongOrderException() + private static RuntimeException WrongOrderException() { return new RuntimeException ("Ошибочный порядок записи XML", "Wrong order of XML record"); } - public static RuntimeException NoSystemIdException() + private static RuntimeException NoSystemIdException() { return new RuntimeException ("Отсутствует системный идентификатор", "System ID missing"); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/OneScript.StandardLibrary/Xml/XmlWriterImpl.cs` around lines 526 - 540, The two factory helpers used only by XmlWriterImpl.WriteDocumentType are more visible than necessary: WrongOrderException() and NoSystemIdException() are declared public static even though they are internal implementation details. Change their visibility to private static in XmlWriterImpl so the public API surface is reduced without affecting behavior, and keep their use confined to WriteDocumentType.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/OneScript.StandardLibrary/Xml/XmlWriterImpl.cs`:
- Around line 332-335: Add a test for the remaining ArgumentException path in
WriteDocType by covering an invalid DOCTYPE name in xmlwrite.os. Extend the
existing XmlWriterImpl/XmlWriter WriteDocType coverage to verify that passing a
bad name triggers RuntimeException.InvalidNthArgumentValue(1), alongside the
current valid, missing system-id, and wrong-order cases.
---
Nitpick comments:
In `@src/OneScript.StandardLibrary/Xml/XmlWriterImpl.cs`:
- Around line 526-540: The two factory helpers used only by
XmlWriterImpl.WriteDocumentType are more visible than necessary:
WrongOrderException() and NoSystemIdException() are declared public static even
though they are internal implementation details. Change their visibility to
private static in XmlWriterImpl so the public API surface is reduced without
affecting behavior, and keep their use confined to WriteDocumentType.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 18deac6a-4405-4aed-86d6-d0bb3984d250
📒 Files selected for processing (2)
src/OneScript.StandardLibrary/Xml/XmlWriterImpl.cstests/xmlwrite.os
Осталось отличие - нет пробела между
"и[Summary by CodeRabbit