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

feat: subject length 0 turns the length check off - #660

Merged
shenxianpeng merged 1 commit into
mainfrom
feat/subject-length-zero-disables
Nov 8, 2026
Merged

shenxianpeng merged 1 commit into
mainfrom
feat/subject-length-zero-disables

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

What

subject_max_length = 0 used to mean "at most 0 characters", which failed every commit. So a project that only wants the AI check (ai_attribution = "forbid", conventional_commits = false) still got the default 80-character limit, with no clean way to turn it off. Projects that run the AI check alone set the limit to an arbitrary number such as 150 or 1000, or their dependency-update PRs fail. Renovate subjects such as Update dependency com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer to v20261103 run to 95 characters.

Now 0 turns subject_max_length and subject_min_length off, the same way max_path_length = 0 already turns off the files check.

Before / after

$ CCHK_AI_ATTRIBUTION=forbid CCHK_CONVENTIONAL_COMMITS=false CCHK_SUBJECT_MAX_LENGTH=0 \
    commit-check -m msg   # msg = the 95-character Renovate subject above
Before (main) After
subject_max_length = 0 [FAIL] CC004 subject-max-length on every commit rule off, exit 0
subject_min_length = 0 rule built, never fails rule off
same setup, plus Co-authored-by: Claude <noreply@anthropic.com> fails (CC004 + CC013) fails (CC013 only)
subject_max_length = 72 unchanged unchanged

A project that only wants the AI check now needs:

[commit]
conventional_commits = false
subject_max_length = 0
ai_attribution = "forbid"

The --subject-max-length / --subject-min-length help text and the README table now say that 0 turns the check off. Negative values are treated as off too, like max_path_length.

Checks

pytest: 1488 passed. New tests cover 0 and -1 for both keys, plus an end-to-end run of the AI-only setup. The one failure, test_load_config_file_permission_error, also fails on main when run as root. ruff check and ruff format are clean.

The commit-check.com docs (configuration reference + an "AI check only" recipe) follow in a separate PR.

subject_max_length = 0 used to mean a limit of 0 characters, so every
commit failed. A project that only wants the AI check
(ai_attribution = "forbid", conventional_commits = false) still got the
default 80-character limit and had to pick an arbitrary large number to
get rid of it; dependency-update subjects from Renovate often run past 80.

0 now switches subject_max_length and subject_min_length off, as
max_path_length = 0 already does for the files check.
@shenxianpeng
shenxianpeng requested a review from a team as a code owner November 8, 2026 03:11
@coderabbitai

coderabbitai Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

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: 8fa5d018-88b6-4a8b-8521-64dc93484296
Commits

Reviewing files that changed from the base of the PR and between 67ad6e3 and 2a5fca5.

Files selected for processing: 5

  • README.md
  • commit_check/main.py
  • commit_check/rule_builder.py
  • tests/main_test.py
  • tests/rule_builder_test.py
  • 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

@github-actions github-actions Bot added the enhancement New feature or request label Nov 8, 2026
@shenxianpeng shenxianpeng self-assigned this Nov 8, 2026
@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 (67ad6e3) to head (2a5fca5).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #660   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           14        14           
  Lines         2458      2460    +2     
  Branches       477       478    +1     
=========================================
+ Hits          2458      2460    +2     

☔ 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 merged commit 9366e3f into main Nov 8, 2026
32 checks passed
@shenxianpeng
shenxianpeng deleted the feat/subject-length-zero-disables branch November 8, 2026 03:21
@codspeed

codspeed Bot commented Nov 8, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 133 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

✅ 660 untouched benchmarks
🆕 1 new benchmark
⏩ 126 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
🆕 test_ai_check_alone_with_length_rules_off N/A 24.9 ms N/A

Comparing feat/subject-length-zero-disables (2a5fca5) with main (67ad6e3)

Open in CodSpeed

Footnotes

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

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant