Skip to content

feat: Add documentation and GitHub links to --help output#2682

Merged
koxudaxi merged 1 commit intomainfrom
add-help-links
Dec 18, 2025
Merged

feat: Add documentation and GitHub links to --help output#2682
koxudaxi merged 1 commit intomainfrom
add-help-links

Conversation

@koxudaxi
Copy link
Copy Markdown
Owner

@koxudaxi koxudaxi commented Dec 18, 2025

Summary by CodeRabbit

Release Notes

  • Improvements
    • Command-line help output now displays arguments in sorted order for easier navigation
    • Enhanced visual presentation of help text with colored section headers
    • Improved documentation formatting with added GitHub and reference links in help output

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 18, 2025

Walkthrough

The SortingHelpFormatter class in the arguments module has been refactored to inherit from RawDescriptionHelpFormatter instead of HelpFormatter, with new methods to sort arguments and preserve colored section headers. The argument parser initialization has been enhanced with additional usage information and documentation links in the epilog.

Changes

Cohort / File(s) Summary
SortingHelpFormatter enhancements and parser initialization
src/datamodel_code_generator/arguments.py
Changed SortingHelpFormatter to inherit from RawDescriptionHelpFormatter; added add_arguments() method to sort actions by option_strings; enhanced start_section() to apply colored formatting using _bold_cyan() helper; imported RawDescriptionHelpFormatter; expanded arg_parser initialization with usage description and epilog containing documentation and GitHub links; updated class docstring to reflect new formatting capabilities.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Verify inheritance change from HelpFormatter to RawDescriptionHelpFormatter does not introduce unintended behavioral changes
  • Confirm sorting logic in add_arguments() correctly orders arguments and does not break existing help text layout
  • Review color handling in start_section() to ensure it functions correctly with the no_color configuration flag
  • Validate new epilog content for accuracy of links and formatting

Poem

🐰 With colors bright and sorted lines so true,
Our formatter now shows arguments through!
From cyan headings to the links we cite,
The help text blooms—a clearer, brighter light! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: adding documentation and GitHub links to the --help output through enhanced epilog and section header formatting.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-help-links

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5c25e38 and 1a24a80.

📒 Files selected for processing (1)
  • src/datamodel_code_generator/arguments.py (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: 3.14 on macOS
  • GitHub Check: 3.14 on Windows
  • GitHub Check: 3.11 on macOS
  • GitHub Check: 3.9 on macOS
  • GitHub Check: 3.12 on Windows
  • GitHub Check: 3.11 on Windows
  • GitHub Check: benchmarks
🔇 Additional comments (6)
src/datamodel_code_generator/arguments.py (6)

12-12: LGTM! Import is necessary for the enhanced formatter.

The addition of RawDescriptionHelpFormatter correctly supports the new inheritance pattern that preserves epilog formatting.


65-66: LGTM! Appropriate inheritance change.

Switching to RawDescriptionHelpFormatter is the correct choice for preserving the epilog formatting. The docstring accurately reflects the class's enhanced responsibilities.


68-70: LGTM! Correct ANSI color implementation.

The ANSI escape codes for bold cyan formatting are correctly implemented.


72-75: LGTM! Clean implementation of argument sorting.

The method correctly sorts arguments by their option strings before displaying them, which will improve help output readability.


77-79: LGTM! Colored section headers enhance readability.

The conditional color application correctly respects the no_color flag while improving the visual organization of help output.


82-90: Excellent enhancement! Documentation links improve discoverability.

Adding the usage description and epilog with direct links to documentation and GitHub makes it easier for users to find additional help and resources.


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

Comment @coderabbitai help to get the list of available commands and usage tips.

@koxudaxi koxudaxi marked this pull request as ready for review December 18, 2025 14:21
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Dec 18, 2025

CodSpeed Performance Report

Merging #2682 will not alter performance

Comparing add-help-links (1a24a80) with main (5c25e38)

Summary

✅ 52 untouched
⏩ 10 skipped1

Footnotes

  1. 10 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.52%. Comparing base (5c25e38) to head (1a24a80).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2682   +/-   ##
=======================================
  Coverage   99.52%   99.52%           
=======================================
  Files          79       79           
  Lines       11174    11174           
  Branches     1348     1348           
=======================================
  Hits        11121    11121           
  Misses         32       32           
  Partials       21       21           
Flag Coverage Δ
unittests 99.52% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@koxudaxi koxudaxi merged commit e70273a into main Dec 18, 2025
40 checks passed
@koxudaxi koxudaxi deleted the add-help-links branch December 18, 2025 14:30
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