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

fix: skip the subject length rules for Dependabot and Renovate commits - #705

Merged
shenxianpeng merged 3 commits into
mainfrom
fix/skip-dependency-bot-commits
Nov 17, 2026
Merged

shenxianpeng merged 3 commits into
mainfrom
fix/skip-dependency-bot-commits

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Before: Dependabot and Renovate write the subject from the package path and versions. With the default 80-character limit, an update to a package with a long name fails CC004 on the bot's own pull request, and nobody can shorten it:

$ echo "chore(deps): Bump org.zalando:logbook-spring-boot-webflux-autoconfigure from 4.0.3 to 4.0.4" \
    | GIT_AUTHOR_NAME='dependabot[bot]' commit-check -m
✖ Commit rejected by Commit Check · 1 check failed

✖ CC004 subject-max-length failed: chore(deps): Bump org.zalando:logbook-spring-boot-webflux-autoconfigure from 4.0.3 to 4.0.4
  Subject is 91 characters; it must be at most 80 characters
  Suggest: Shorten the subject by 11 characters, to 80 or fewer
  Docs:    https://commit-check.com/rules/#cc004
$ echo $?
1

The ways around it were to put the bot in ignore_authors, which turns off every commit rule for it, or to raise the limit for everyone.

After: The two length rules skip that commit and say why; every other rule still judges it:

$ echo "chore(deps): Bump ..." | GIT_AUTHOR_NAME='dependabot[bot]' commit-check -m --format json
  CC001 message             pass
  CC004 subject_max_length  skip   reason: dependabot[bot] writes the subject from the package name and versions
$ echo $?
0

The same subject from anyone else fails CC004 as before.

How: SubjectLengthValidator asks for the author only once a subject is out of bounds, so a passing subject costs no lookup. The author comes from the commit for --rev and for HEAD, and from GIT_AUTHOR_NAME for a piped message or message file, which is how the Action passes each pull request commit's author. A piped message does not fall back to the local git config: a local hook's author is a person, and the benchmarked failure tests start no git process. The names match exactly: dependabot[bot] and renovate[bot] (new tuple DEPENDENCY_UPDATE_BOTS).

Only the length rules are skipped, not every rule, so a commit that names itself dependabot[bot] still gets the format, AI and sign-off rules; spoofing the name buys nothing beyond the length.

No new option, check or rule ID. README: the CC004 row says the bots skip both length rules. ignore_authors keeps its default [].

Tests: both bots skipped via GIT_AUTHOR_NAME, --rev and HEAD; a person with the same subject fails; near-miss names (dependabot, Dependabot[bot]) fail; a passing subject looks up no author; a piped message does not read git config; through the engine, CC004 skips while CC001 still fails a bot's non-conventional subject.

Merged main after #704. One more commit on top, 8b9f9cf, finishes #704: a title that already ends in a number, such as a backport's (#12), gets a second (#34) from the squash merge, and only the last one was left out. The whole trailing run is now left out, so the title measures the same before and after the merge (test added). 1702 tests pass, coverage 100%.

Both bots write the subject from the package path and versions, so a long
one is not a person's to shorten, and a repository had to ignore the bots
altogether or raise the limit for everyone. CC004 and CC005 now skip a
commit whose author is dependabot[bot] or renovate[bot]; every other rule
still judges it. The author is looked up only once a subject is out of
bounds.
@shenxianpeng
shenxianpeng requested a review from a team as a code owner November 17, 2026 20:44
@coderabbitai

coderabbitai Bot commented Nov 17, 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 51 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: 9f8d696d-2ca5-4d4d-916f-4991327ee9e6
Commits

Reviewing files that changed from the base of the PR and between b3121a0 and 8b9f9cf.

Files selected for processing: 4

  • README.md
  • commit_check/__init__.py
  • commit_check/engine.py
  • tests/engine_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 bug Something isn't working label Nov 17, 2026
@shenxianpeng shenxianpeng self-assigned this Nov 17, 2026
@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (b3121a0) to head (8b9f9cf).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #705   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           15        15           
  Lines         2710      2727   +17     
  Branches       537       541    +4     
=========================================
+ Hits          2710      2727   +17     

☔ 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.

…ot-commits

# Conflicts:
#	README.md
#	commit_check/engine.py
#	tests/engine_test.py
A title that already ends in a number, such as a backport's " (#12)", gets
a second one from the squash merge, and only the last was left out, so a
title that passed on the pull request could fail once merged.
@shenxianpeng
shenxianpeng merged commit 32cb25a into main Nov 17, 2026
11 of 12 checks passed
@shenxianpeng
shenxianpeng deleted the fix/skip-dependency-bot-commits branch November 17, 2026 20:50
@sonarqubecloud

Copy link
Copy Markdown

@codspeed

codspeed Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

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

✅ 548 untouched benchmarks
⏩ 268 skipped benchmarks1


Comparing fix/skip-dependency-bot-commits (487a874) with main (49a0b99)

Open in CodSpeed

Footnotes

  1. 268 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

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant