Skip to content

feat: co-author ignore, org-level config inheritance, git-config author validation, test mock fix#387

Merged
shenxianpeng merged 11 commits into
mainfrom
copilot/make-commit-check-famous
Apr 2, 2026
Merged

feat: co-author ignore, org-level config inheritance, git-config author validation, test mock fix#387
shenxianpeng merged 11 commits into
mainfrom
copilot/make-commit-check-famous

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

Makes commit-check the most comprehensive Git commit/branch enforcement tool by fixing three open issues and adding a high-value organizational feature.

Bug fixes

  • Wrong mock target (#test): test_main_with_message_empty_string_no_stdin_with_git was patching commit_check.util.get_commit_info — ineffective since engine.py imports the function directly. Fixed to patch commit_check.engine.get_commit_info. Also changed the test message to use an imperative verb to work with subject_imperative = true.

New features

Co-author bypass in ignore_authors (Issue #290)

_should_skip_commit_validation() now parses Co-authored-by: trailers. If any co-author name matches ignore_authors, all commit checks are skipped. Fixes the common pattern where AI bots (e.g., coderabbitai) co-author commits with non-conventional messages.

[commit]
ignore_authors = ["dependabot[bot]", "coderabbitai[bot]", "copilot[bot]"]

Organization-level config inheritance via inherit_from (Issue #384)

New top-level inherit_from key in TOML config. Supports a github: shorthand (modelled after Release Drafter), local file paths, and HTTPS URLs. HTTP (non-TLS) is rejected to prevent MITM attacks. Parent config is loaded first; local keys override.

Supported formats:

  • github:owner/repo:path/to/cchk.toml — fetches from raw.githubusercontent.com at HEAD
  • github:owner/repo@ref:path/to/cchk.toml — pins to a specific branch/tag/SHA
  • A local file path (relative or absolute)
  • An HTTPS URL
# .github/cchk.toml
inherit_from = "github:my-org/.github:cchk.toml"

[commit]
subject_max_length = 72  # overrides parent

Git config author validation (Issue #298)

Added get_git_config_value(key) utility. AuthorValidator now checks git config user.name / user.email first (the identity that will be used for the next commit), falling back to git log if unset. Previously, a misconfigured user.name (e.g., starting with a digit) would pass if the last commit had a valid author.

Other

  • cchk.toml: added coderabbitai[bot] to ignore_authors
  • README: comparison table vs commitlint/pre-commit, Quick Start, inherit_from docs, additional badges
  • docs/configuration.rst: inherit_from section with github: shorthand examples, updated ignore_authors description
  • 269 tests pass (24 new tests added, including 8 for the github: shorthand)
Original prompt

你是一名非常知名的开源作者,拥有很多个关注度很高、Star 很多的开源项目。

目标:你现在的目标是将 Commit Check 这个项目变成社区中关于 Git commit、Git 分支以及 Git 其他检查最著名的项目,没有之一。

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 2, 2026

Deploy Preview for commit-check ready!

Name Link
🔨 Latest commit f4bed34
🔍 Latest deploy log https://app.netlify.com/projects/commit-check/deploys/69ceea7b59703d0008a8a154
😎 Deploy Preview https://deploy-preview-387--commit-check.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI and others added 2 commits April 2, 2026 18:41
Copilot AI changed the title [WIP] Enhance commit check project for community recognition feat: co-author ignore, org-level config inheritance, git-config author validation, test mock fix Apr 2, 2026
Copilot AI requested a review from shenxianpeng April 2, 2026 18:44
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Apr 2, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 2, 2026

Merging this PR will degrade performance by 37.34%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 3 regressed benchmarks
✅ 167 untouched benchmarks
🆕 32 new benchmarks
⏩ 108 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
🆕 test_shorthand_with_subdirectory N/A 110.9 µs N/A
🆕 test_load_from_url_success N/A 1.5 ms N/A
test_get_author_value_with_email_format 544.7 µs 869.4 µs -37.34%
🆕 test_load_from_url_http_error N/A 561 µs N/A
test_author_validator_name_valid 934 µs 1,292.2 µs -27.72%
🆕 test_load_from_url_network_error N/A 546.7 µs N/A
test_author_validator_email_valid 939.2 µs 1,301.4 µs -27.84%
🆕 test_inherit_from_github_shorthand N/A 1.5 ms N/A
🆕 test_inherit_from_github_shorthand_with_ref N/A 1.5 ms N/A
🆕 test_inherit_from_local_file N/A 394 µs N/A
🆕 test_inherit_from_http_url_is_rejected N/A 556.8 µs N/A
🆕 test_inherit_from_nonexistent_file_is_ignored N/A 171 µs N/A
🆕 test_deep_merge_does_not_mutate_base N/A 114.8 µs N/A
🆕 test_load_config_with_inherit_from_local N/A 530.6 µs N/A
🆕 test_inherit_from_key_is_removed_from_result N/A 166.8 µs N/A
🆕 test_inherit_from_url_failure_is_ignored N/A 553.5 µs N/A
🆕 test_shorthand_with_ref N/A 110.7 µs N/A
🆕 test_deep_merge_simple N/A 110.9 µs N/A
🆕 test_basic_shorthand N/A 110 µs N/A
🆕 test_empty_path_returns_none N/A 107.6 µs N/A
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.


Comparing copilot/make-commit-check-famous (f4bed34) with main (40cbacd)

Open in CodSpeed

Footnotes

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

@shenxianpeng shenxianpeng added enhancement New feature or request and removed documentation Improvements or additions to documentation labels Apr 2, 2026
Comment thread README.rst Outdated
Comment thread README.rst Outdated
@github-actions github-actions Bot added bug Something isn't working documentation Improvements or additions to documentation labels Apr 2, 2026
pre-commit-ci Bot and others added 3 commits April 2, 2026 19:05
…' into copilot/make-commit-check-famous

# Conflicts:
#	tests/config_test.py

Co-authored-by: shenxianpeng <3353385+shenxianpeng@users.noreply.github.com>
Comment thread tests/config_test.py Dismissed
Copilot AI requested a review from shenxianpeng April 2, 2026 19:11
@shenxianpeng shenxianpeng added major-rfe For changelog: Major enhancement. Will be highlighted on the top and removed bug Something isn't working documentation Improvements or additions to documentation labels Apr 2, 2026
@github-actions github-actions Bot added bug Something isn't working documentation Improvements or additions to documentation labels Apr 2, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 2, 2026

Codecov Report

❌ Patch coverage is 96.66667% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.17%. Comparing base (40cbacd) to head (f4bed34).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
commit_check/config.py 94.82% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #387      +/-   ##
==========================================
+ Coverage   95.04%   95.17%   +0.13%     
==========================================
  Files           9        9              
  Lines         807      892      +85     
==========================================
+ Hits          767      849      +82     
- Misses         40       43       +3     

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

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 2, 2026

Quality Gate Passed Quality Gate passed

Issues
11 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@shenxianpeng shenxianpeng marked this pull request as ready for review April 2, 2026 22:24
@shenxianpeng shenxianpeng requested a review from a team as a code owner April 2, 2026 22:24
@shenxianpeng shenxianpeng merged commit 5877170 into main Apr 2, 2026
34 of 35 checks passed
@shenxianpeng shenxianpeng deleted the copilot/make-commit-check-famous branch April 2, 2026 22:24
@shenxianpeng shenxianpeng added minor A minor version bump and removed bug Something isn't working documentation Improvements or additions to documentation major-rfe For changelog: Major enhancement. Will be highlighted on the top labels Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request minor A minor version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants