Skip to content

Require @cli_doc marker for all CLI options#2712

Merged
koxudaxi merged 1 commit intomainfrom
fix/require-cli-doc-for-meta-options
Dec 20, 2025
Merged

Require @cli_doc marker for all CLI options#2712
koxudaxi merged 1 commit intomainfrom
fix/require-cli-doc-for-meta-options

Conversation

@koxudaxi
Copy link
Copy Markdown
Owner

@koxudaxi koxudaxi commented Dec 20, 2025

Summary by CodeRabbit

  • Tests
    • Restructured CLI documentation validation tests with consolidated test cases for improved clarity.

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 20, 2025

Walkthrough

Test coverage validation for CLI documentation was refactored. The constant DOCUMENTED_OPTIONS was removed, a test method was renamed and reimplemented to dynamically compute missing options, and meta-related tests were consolidated into a new test that validates no overlap exists between CLI_OPTION_META and MANUAL_DOCS.

Changes

Cohort / File(s) Change Summary
Test refactoring
tests/cli_doc/test_cli_doc_coverage.py
Removed DOCUMENTED_OPTIONS constant; renamed test_documented_options_have_cli_doc_markers to test_all_options_have_cli_doc_markers with updated logic using get_all_canonical_options() minus MANUAL_DOCS; replaced meta-related tests with new test_meta_options_not_manual to validate no overlap between CLI_OPTION_META keys and MANUAL_DOCS; updated error messaging terminology.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Single test file with straightforward refactoring
  • Test logic changes are clear and follow a consistent pattern
  • Renamed/reimplemented methods have transparent intent
  • No complex interdependencies or multi-file impacts

Poem

🐰 A constant bid farewell, as tests grow wise,
Dynamic checks now see with fresher eyes,
No overlap allowed, the meta and manual dance,
Documentation guards stand at their stance! 📋

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 describes the main change: requiring @cli_doc markers for all CLI options, which aligns with the refactoring from using DOCUMENTED_OPTIONS to computing options dynamically via get_all_canonical_options().
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 fix/require-cli-doc-for-meta-options

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
tests/cli_doc/test_cli_doc_coverage.py (2)

49-61: Excellent refactoring to dynamic option discovery.

The change from a hardcoded DOCUMENTED_OPTIONS constant to dynamically computing missing options is a significant improvement in maintainability. New CLI options will now be automatically validated without manual updates to a constant.

However, the # noqa: PLR6301 directive is unnecessary since PLR6301 is not enabled.

🔎 Remove unused noqa directive
-    def test_all_options_have_cli_doc_markers(  # noqa: PLR6301
+    def test_all_options_have_cli_doc_markers(
         self, collected_options: set[str]
     ) -> None:

Based on static analysis hints.


63-71: Good validation to ensure consistency.

This test enforces a reasonable constraint: options with metadata in CLI_OPTION_META should not be excluded from documentation via MANUAL_DOCS. This helps maintain consistency in the documentation requirements.

However, the # noqa: PLR6301 directive is unnecessary since PLR6301 is not enabled.

🔎 Remove unused noqa directive
-    def test_meta_options_not_manual(self) -> None:  # noqa: PLR6301
+    def test_meta_options_not_manual(self) -> None:
         """Verify that CLI_OPTION_META options are not in MANUAL_DOCS."""

Based on static analysis hints.

📜 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 134c7c2 and 895df83.

📒 Files selected for processing (1)
  • tests/cli_doc/test_cli_doc_coverage.py (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
tests/cli_doc/test_cli_doc_coverage.py (1)
src/datamodel_code_generator/cli_options.py (1)
  • get_all_canonical_options (269-271)
🪛 Ruff (0.14.8)
tests/cli_doc/test_cli_doc_coverage.py

49-49: Unused noqa directive (non-enabled: PLR6301)

Remove unused noqa directive

(RUF100)


63-63: Unused noqa directive (non-enabled: PLR6301)

Remove unused noqa directive

(RUF100)

⏰ 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). (11)
  • GitHub Check: py312-black24 on Ubuntu
  • GitHub Check: 3.13 on macOS
  • GitHub Check: 3.10 on macOS
  • GitHub Check: 3.10 on Windows
  • GitHub Check: py312-pydantic1 on Ubuntu
  • GitHub Check: 3.13 on Windows
  • GitHub Check: 3.14 on Windows
  • GitHub Check: 3.12 on Windows
  • GitHub Check: 3.11 on Windows
  • GitHub Check: benchmarks
  • GitHub Check: Analyze (python)
🔇 Additional comments (1)
tests/cli_doc/test_cli_doc_coverage.py (1)

1-7: LGTM! Clear documentation.

The updated docstring accurately reflects the purpose of the test module and clarifies the exception for MANUAL_DOCS.

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.34%. Comparing base (134c7c2) to head (895df83).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2712      +/-   ##
==========================================
- Coverage   99.34%   99.34%   -0.01%     
==========================================
  Files          81       81              
  Lines       11535    11534       -1     
  Branches     1387     1387              
==========================================
- Hits        11459    11458       -1     
  Misses         45       45              
  Partials       31       31              
Flag Coverage Δ
unittests 99.34% <ø> (-0.01%) ⬇️

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.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Dec 20, 2025

CodSpeed Performance Report

Merging #2712 will not alter performance

Comparing fix/require-cli-doc-for-meta-options (895df83) with main (134c7c2)

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.

@koxudaxi koxudaxi merged commit e3a2cf5 into main Dec 20, 2025
36 checks passed
@koxudaxi koxudaxi deleted the fix/require-cli-doc-for-meta-options branch December 20, 2025 13:31
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