-
-
Notifications
You must be signed in to change notification settings - Fork 32
fix: code quality #264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: code quality #264
Conversation
Reviewer's GuideRefactors ID generation and parameter naming for JSON-to-XML conversion utilities, improves type hints and xml_namespaces handling, simplifies get_unique_id, and updates tests and project dev dependencies to match the new behavior and code quality standards. Class diagram for updated JSON-to-XML conversion utilitiesclassDiagram
class Json2xml {
-data
-root: str
-item_wrap: bool
-xpath_format: bool
+__init__(data, root, item_wrap, xpath_format)
+to_xml() str | bytes | None
}
class dicttoxml_module {
<<module>>
+get_unique_id(element) str
+dict2xml_str(item, ids, attr_type, item_func, cdata, item_name, item_wrap, parent_is_list, parent, list_headers) str
+dicttoxml(data, custom_root, attr_type, item_name, item_wrap, item_func, cdata, xml_namespaces, list_headers, xpath_format) bytes
}
Json2xml ..> dicttoxml_module : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #264 +/- ##
===========================================
+ Coverage 99.69% 100.00% +0.30%
===========================================
Files 3 3
Lines 330 323 -7
===========================================
- Hits 329 323 -6
+ Misses 1 0 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey - I've left some high level feedback:
- Renaming the
dict2xml_strparameter fromparentIsListtoparent_is_listchanges the public function signature and may break external callers using keyword arguments; consider keeping the old name as a backwards-compatible alias or accepting both via**kwargs. - The
.cursor/commands/supermemory.mdfile appears to be an editor/agent configuration artifact rather than project code; consider removing it from the repository or adding it to.gitignore.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Renaming the `dict2xml_str` parameter from `parentIsList` to `parent_is_list` changes the public function signature and may break external callers using keyword arguments; consider keeping the old name as a backwards-compatible alias or accepting both via `**kwargs`.
- The `.cursor/commands/supermemory.md` file appears to be an editor/agent configuration artifact rather than project code; consider removing it from the repository or adding it to `.gitignore`.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
- Delete dead code (unused string join in dict2xml_str)
- Move test deps from main dependencies to [project.optional-dependencies]
- Fix mutable default argument (xml_namespaces={} -> None)
- Simplify get_unique_id (remove dead while loop logic)
- Fix vague return type (Any -> str | bytes | None)
- Fix inconsistent naming (parentIsList -> parent_is_list)
- Remove unused Union import, modernize type alias with | syntax
- Add isinstance checks in tests to satisfy type checker
uvx ty runs in isolated environment and cannot resolve pytest imports in test files. Type checking the main module is sufficient.
Summary by Sourcery
Simplify XML ID generation and typing while improving configuration defaults and test coverage for XML conversion utilities.
Enhancements:
Build:
Documentation:
Tests:
Chores: