Skip to content

refactor: drop CC504 required sections before release - #752

Merged
shenxianpeng merged 1 commit into
mainfrom
chore/drop-cc504
Dec 3, 2026
Merged

shenxianpeng merged 1 commit into
mainfrom
chore/drop-cc504

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

What

Drops CC504 ([pull_request] required_sections) before it ships. CC503 ([pull_request] description_min_length) stays as merged.

Before / after

Before, with required_sections = ["Summary"] in cchk.toml, --pr-body ran CC504 and failed a description whose "Summary" section was empty.

After, required_sections is an unknown [pull_request] key: commit-check warns about it and runs no CC504. CC503 runs as before.

Changes

  • Removed: the CC504 catalog entry, its validator and section parser, the rule builder for required_sections, the config key, and its README rows.
  • ai_declaration_checkboxes parsing is back to its own function (the shared list parser existed only for CC504).
  • Kept for CC503: headings (# and underlined), task lists, rules (---) and empty bullets are still not the author's words, and --pr-body still reads the description unstripped.
  • Tests that checked those cases through CC504 now check them through CC503's word count. The GitLab cut-description test now leaves CC502 and CC503 undecided.
  • commit-check-ci: CC502 or CC503 alone turns the description check on.

Checks

ruff, mypy, and the full test suite pass with 100% coverage. The one failure, test_load_config_file_permission_error, also fails on main when the tests run as root.


Generated by Claude Code

Summary by CodeRabbit

  • Changes
    • Pull request descriptions are no longer checked for required sections (CC504). The remaining description checks cover AI-related rules, issue references, and minimum length when configured.
    • The documented access-token requirements now reflect the description rules that still require a token.
    • AI declaration checkbox options now accept a single string or a list of strings; empty options are rejected and case-insensitive duplicates are removed.

CC504 (`[pull_request] required_sections`) has not shipped, so it goes
before the next release. CC503 `description_min_length` stays, with
what it counts unchanged: headings, task lists, rules and empty bullets
are not the author's words. Tests that checked those through CC504 now
check them through CC503.
@shenxianpeng
shenxianpeng requested a review from a team as a code owner December 3, 2026 19:58
@shenxianpeng shenxianpeng added refactor Refactor source code skip-changelog labels Dec 3, 2026 — with Claude
@shenxianpeng shenxianpeng self-assigned this Dec 3, 2026
@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pull request removes CC504 required-sections validation from configuration, rule construction, and the validation engine. It updates CI check activation, tests, command help, and documentation. CC501–CC503 remain documented and supported.

Changes: Pull request description rules

Layer / File(s) Summary
Remove CC504 from rule configuration
commit_check/rule_builder.py, commit_check/rules_catalog.py, commit_check/config_merger.py, tests/rule_builder_test.py, tests/rules_catalog_test.py, tests/config_merger_test.py, README.md, bitbucket-pipe/README.md, commit_check/main.py
The rule builder and catalog no longer create or list CC504. The configuration reference, command help, token documentation, and related tests no longer include required_sections. Declaration-checkbox settings retain their string/list validation without the removed generic text-list helper.
Remove required-sections validation
commit_check/engine.py, tests/engine_test.py
The heading and section-content helpers, RequiredSectionsValidator, and its validator mapping are removed. Tests now cover author-text extraction and description-length validation.
Update CI description-check activation
commit_check/ci.py, tests/ci_test.py
Only issue-reference and minimum-length settings can independently enable description checking. CI tests now exercise the minimum-length rule instead of required sections.

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

Change: Refactor

Possibly related PRs

Suggested reviewers: invictustitan2

Merge Risk: Minimal · up to 986ac

This change removes the CC504 required-sections check before release. A stale required_sections setting now produces an unknown-key warning instead of being enforced. CC501 to CC503 are unchanged, and no merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "refactor: drop CC504 required sections before release" matches the main change. The PR removes the CC504 required-sections rule, its validator, section parser, rule builder entry, config ke…
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 "refactor: drop CC504 required sections before release" matches the main change. The PR removes the CC504 required-sections rule, its validator, section parser, rule builder entry, config key, and README rows. The title is specific and short, and it names the rule and the change type. It does not cover the restored ai_declaration_checkboxes parser or the test moves, which is acceptable for a title.

Finishing Touches

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: d0af72f3-a639-416c-9a1e-fecbc5770390
Commits

Reviewing files that changed from the base of the PR and between b059734 and 986ac57.

Files selected for processing: 13

  • README.md
  • bitbucket-pipe/README.md
  • commit_check/ci.py
  • commit_check/config_merger.py
  • commit_check/engine.py
  • commit_check/main.py
  • commit_check/rule_builder.py
  • commit_check/rules_catalog.py
  • tests/ci_test.py
  • tests/config_merger_test.py
  • tests/engine_test.py
  • tests/rule_builder_test.py
  • tests/rules_catalog_test.py
Files with no reviewable changes: 2

  • commit_check/rules_catalog.py
  • tests/config_merger_test.py

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

@sonarqubecloud

sonarqubecloud Bot commented Dec 3, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Dec 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (b059734) to head (986ac57).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #752   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           17        17           
  Lines         3835      3773   -62     
  Branches       775       761   -14     
=========================================
- Hits          3835      3773   -62     

☔ 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 5cf1274 into main Dec 3, 2026
33 checks passed
@shenxianpeng
shenxianpeng deleted the chore/drop-cc504 branch December 3, 2026 20:02
@codspeed

codspeed Bot commented Dec 3, 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

✅ 685 untouched benchmarks
⏩ 132 skipped benchmarks1


Comparing chore/drop-cc504 (986ac57) with main (b059734)

Open in CodSpeed

Footnotes

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

refactor Refactor source code skip-changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant