← 输入框|github.com|刷新
Skip to content

fix: name the AI-rules-only option --ai-attribution-only - #677

Merged
shenxianpeng merged 1 commit into
mainfrom
feature/ai-attribution-only
Nov 8, 2026
Merged

shenxianpeng merged 1 commit into
mainfrom
feature/ai-attribution-only

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Why

--ai-only (new in 2.20.1) does not say what it limits the run to. It runs only the AI attribution rules (CC013 to CC016), so text that is not a commit message, such as a pull request description, can be checked without the commit-message format rules.

What changes

  • The option is now --ai-attribution-only, which pairs with the existing --ai-attribution policy option.
  • --ai-only keeps working as a hidden alias, so scripts written against 2.20.1 do not break. It no longer appears in --help.
  • README, comments and tests use the new name.

Before and after

Before (2.20.1) After
--help --ai-only check only the AI attribution of the message ... --ai-attribution-only check only the AI attribution of the message ...
commit-check --ai-only < body.md works still works, same result
commit-check --ai-attribution-only < body.md unknown option works

Checks

  • pytest: 1600 passed, 100% line and branch coverage (the one failure is test_load_config_file_permission_error, which fails only when run as root).
  • New tests: the old name gives the same result, and it is not in --help.
  • ruff check, ruff format, mypy clean.

Summary by CodeRabbit

  • New Features
    • Added --ai-attribution-only as the visible command-line option for running AI attribution checks. The existing --ai-only option remains available as a hidden compatibility alias.
  • Documentation
    • Updated the usage guide and check descriptions to use the new option name. The checks performed remain unchanged.

--ai-only did not say what it limits the run to. --ai-attribution-only
pairs with the --ai-attribution policy option and says it checks only
the AI attribution of the text (CC013 to CC016).

--ai-only, the name 2.20.1 shipped with, still works as a hidden alias.
@shenxianpeng
shenxianpeng requested a review from a team as a code owner November 8, 2026 21:55
@github-actions github-actions Bot added bug Something isn't working enhancement New feature or request labels Nov 8, 2026
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The CLI now presents --ai-attribution-only as the option for AI attribution checks. The former --ai-only spelling remains available as a hidden alias. Argument handling, documentation, and tests use the new name.

Changes: AI attribution flag

Layer / File(s) Summary
Rename the AI attribution flag
commit_check/main.py, tests/main_test.py, README.md, commit_check/engine.py, commit_check/rules_catalog.py
The CLI uses --ai-attribution-only and the shared ai_attribution_only destination. The old flag remains a hidden alias. Related documentation and tests use the new name; tests check alias behavior and help output.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Possibly related PRs

Merge Risk: Minimal · up to ae709

The option is renamed with the previous spelling retained as an alias. No merge-blocking risk was identified.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the change: the AI-rules-only CLI option is renamed to --ai-attribution-only. The raw summary confirms the rename in main.py, engine.py, rules_catalog.py, README.md, and tests, and it …
Docstring Coverage Passed Docstring coverage is 83.33% 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. Documentati…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the change: the AI-rules-only CLI option is renamed to --ai-attribution-only. The raw summary confirms the rename in main.py, engine.py, rules_catalog.py, README.md, and tests, and it keeps --ai-only as a hidden alias. The title is concise, specific, and matches the main change. The 'fix:' prefix fits the compatibility-focused rename, though the change is mostly a naming update.

Full details: Docstring Coverage

Explanation

Docstring coverage is 83.33% 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 6 functions across 4 files. (1 skipped: 1 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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c1a92ff0-90af-424f-b8c7-fe2b96d5e4b3
Commits

Reviewing files that changed from the base of the PR and between 2761f6e and ae709ac.

Files selected for processing: 5

  • README.md
  • commit_check/engine.py
  • commit_check/main.py
  • commit_check/rules_catalog.py
  • tests/main_test.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@sonarqubecloud

sonarqubecloud Bot commented Nov 8, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Nov 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (2761f6e) to head (ae709ac).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #677   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           14        14           
  Lines         2518      2519    +1     
  Branches       488       488           
=========================================
+ Hits          2518      2519    +1     

☔ View full report in Codecov by Harness.
📢 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.

@shenxianpeng shenxianpeng removed the enhancement New feature or request label Nov 8, 2026
@shenxianpeng
shenxianpeng merged commit 9aba6ad into main Nov 8, 2026
34 checks passed
@shenxianpeng
shenxianpeng deleted the feature/ai-attribution-only branch November 8, 2026 22:00
@codspeed

codspeed Bot commented Nov 8, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 135 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 684 untouched benchmarks
⏩ 131 skipped benchmarks1


Comparing feature/ai-attribution-only (ae709ac) with main (a3ee002)2

Open in CodSpeed

Footnotes

  1. 131 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. ↩

  2. No successful run was found on main (2761f6e) during the generation of this report, so a3ee002 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant