Skip to content

feat: show a one-screen intro when commit-check runs without a check - #718

Merged
shenxianpeng merged 3 commits into
mainfrom
feature/bare-command-intro
Nov 19, 2026
Merged

shenxianpeng merged 3 commits into
mainfrom
feature/bare-command-intro

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

What

Running commit-check with no check flag printed all 152 lines of the argparse help. Someone typing the name to see what it is got a wall of [--flag VALUE] brackets first.

Now a bare run prints one screen: version, three common commands, which config the run would read (or that the defaults apply), and the docs link. Exit code is still 0.

--help opens with a one-line usage (usage: commit-check [options] [commit_msg_file]) instead of 20 lines of every flag. The option list under it is unchanged.

Before / after

before and after

Wording to review

New user-facing text, please check before merge:

  • Commit Check 2.23.0 · commit policy as code
  • check the last commit message and the branch / check a message before you commit it / list every option
  • Config none found, using the defaults: Conventional Commits, Conventional Branch, subjects up to 80 characters
  • With a config: Config cchk.toml (path relative to where you run it)

Tests

  • test_no_args_shows_help now checks the intro and that it fits in 12 lines
  • New: intro names the config, says the defaults apply without one, --help usage is one line
  • Full suite: 1784 passed; the one failure (test_load_config_file_permission_error) also fails on main when run as root

Summary by CodeRabbit

  • User Experience
    • Running the command without options now displays a concise introduction with example commands, the applicable configuration or default checks, and a link to the documentation instead of full help.
    • The help screen now shows a single-line usage summary that includes the available options.

A bare commit-check printed all 152 lines of the argparse help. It now
prints the version, three common commands, the config the run would read
and the docs link. --help opens with a one-line usage instead of a
20-line list of every flag.
@shenxianpeng
shenxianpeng requested a review from a team as a code owner November 19, 2026 22:38
@github-actions github-actions Bot added the enhancement New feature or request label Nov 19, 2026
@shenxianpeng shenxianpeng added the minor A minor version bump label Nov 19, 2026 — with Claude
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

When no checks are requested, the CLI prints a concise introductory screen with examples, configuration information, and a documentation URL. The parser usage string now includes [options].

Changes: CLI Intro Screen

Layer / File(s) Summary
Intro output and CLI behavior
commit_check/main.py, tests/main_test.py
The CLI prints a styled intro when no checks are requested. It identifies the selected config or states that defaults apply. Tests cover the intro content, its length, and the single-line usage form shown by --help.

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

Change: Feature

Merge Risk: Low · up to 978f7

The new intro screen can fail on Windows when the config is on a different drive. It can also report the wrong default subject length when an override is set. Both are narrow, low-impact cases that are easy to fix.

Pre-merge checks: Passed 2

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: when commit-check runs without a check, it now shows a one-screen intro instead of the full help. The raw summary confirms this change in commit_check/main.py and the …
Full details: Title check

Explanation

The title names the main change: when commit-check runs without a check, it now shows a one-screen intro instead of the full help. The raw summary confirms this change in commit_check/main.py and the tests. The title is specific and concise. It is 68 characters and 11 words, which is slightly long but acceptable.

  • 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

@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #718   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           16        16           
  Lines         2980      2995   +15     
  Branches       583       584    +1     
=========================================
+ Hits          2980      2995   +15     

☔ 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 0d6785e into main Nov 19, 2026
33 of 34 checks passed
@shenxianpeng
shenxianpeng deleted the feature/bare-command-intro branch November 19, 2026 22:43
@codspeed

codspeed Bot commented Nov 19, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by ×3.4

1 warning

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

⚡ 1 improved benchmark
✅ 684 untouched benchmarks
⏩ 131 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ test_no_args_shows_help 22.9 ms 6.7 ms ×3.4

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing feature/bare-command-intro (978f78a) with main (00104bd)

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

@shenxianpeng shenxianpeng removed the minor A minor version bump label Nov 20, 2026
shenxianpeng added a commit to commit-check/commit-check.com that referenced this pull request Nov 20, 2026
Docs for CLI v2.23.1, which ships commit-check/commit-check#724.

- **Pins:** every pre-commit `rev:` moves from `v2.23.0` to `v2.23.1`
(Configuration, Example, Compare, pre-commit guide). docs-sync checks
these against PyPI.
- **Changelog:** a v2.23.1 entry and a Highlights row: the message
quoted once over several failures (commit-check/commit-check#719), the
intro on a bare `commit-check` (commit-check/commit-check#718), and
git's revert subjects plus the `revert` type
(commit-check/commit-check#724).
- **Configuration:** `revert` is added to the `allow_commit_types`
default. The length rows say `Revert "..."` and `Reapply "..."` subjects
are not measured, and `allow_revert_commits` now names both subjects.
- **Rules:** CC001 accepts git's revert subjects and points hand-written
reverts to the `revert` type. CC004 lists them under "Not counted".
CC007 covers `Reapply "..."` too.
- **Migration:** the warning no longer tells v1 users to add `revert`
back. It keeps the `task` branch type.
- **Examples:** the sample CC001 output in Getting started, Example and
Other CI lists `revert`. The two-failure sample in the policy guide was
rerun on 2.23.1 and is unchanged.

`pytest tests/` (docs-sync, against commit-check 2.23.1 from PyPI) and
`nox -s docs` (`mkdocs build --strict`) pass locally.

---------

Co-authored-by: Xianpeng Shen <3353385+shenxianpeng@users.noreply.github.com>
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