Repository navigation
Spell the arguments of an option value in one place - #5590
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
| Layer / File(s) | Summary |
|---|---|
Shared option argument mapping src/datamodel_code_generator/_option_names.py |
Adds option_arguments to map boolean values to positive or available negative flags, and other values to a positive flag followed by the value. Lists and tuples expand into separate arguments. |
CLI and recommendation integration src/datamodel_code_generator/__main__.py, src/datamodel_code_generator/_recommend/_rules.py, docs/architecture.md, scripts/decision_homes.toml |
CLI generation and recommendation rules use option_arguments instead of local value-conversion logic. The architecture and decision-home entries record the mapping and related sites. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Refactor
Possibly related issues
- Empty list or tuple option value is written as a bare flag in generated commands #5589: The change centralizes option argument generation in the CLI and recommendation paths named in the issue.
Possibly related PRs
- datamodel-code-generator/datamodel-code-generator#5566: This PR extends the option-name centralization in
_option_names.pyby adding shared value-to-argument conversion. - datamodel-code-generator/datamodel-code-generator#5330: This PR adds list and tuple expansion for option values, which relates to the sequence-valued options introduced there.
Merge Risk: 
Minimal · up to eb5d5
-
The change centralizes option argument generation without an established behavioral regression. It is mergeable subject to normal checks.
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
The title "Spell the arguments of an option value in one place" matches the main change. A new
option_argumentsfunction in_option_names.pynow builds the CLI arguments for a field and value. The__main__.pyand_recommend/_rules.pymodules now delegate to it instead of building arguments inline. The title is specific, concise, and free of noise, so a teammate scanning history can tell what changed.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 3 files. (2 skipped: 2 unsupported.)
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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 @coderabbitai help to get the list of available commands.
Merging this PR will improve performance by 26.37%2 warnings
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Breaking Change AnalysisResult: No breaking changes detected Reasoning: The diff is an internal refactor that adds a private helper option_arguments in _option_names.py and routes generate_cli_command, _cli_arguments and the recommend rules option_arguments through it. The output stays the same for booleans (the negative option, or nothing when the parser defines none), lists, scalars and mappings. The only change is that tuples are now expanded like lists, and TOML config never yields tuples. Only docs and decision_homes.toml rows are otherwise added, and no public CLI option, API, template, default, Python version or error path is removed or changed. The accepted behaviour diff cells describe allOf schemas becoming root models, which comes from earlier parser changes since the last release that this diff does not touch, so they are not attributable to this PR. This analysis was produced by the release draft workflow |
|
🎉 Released in 0.88.0 This PR is now available in the latest release. See the release notes for details. |
Summary by CodeRabbit