-
-
Notifications
You must be signed in to change notification settings - Fork 7
docs: add v2.0.0 documentation #289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
26ec62a
feat: add more RST docs
shenxianpeng 5c1ddf6
Update docs/what-is-new.rst
shenxianpeng defe9c6
Update docs/what-is-new.rst
shenxianpeng 3ba6050
fix: resolve title underline too short
shenxianpeng f138d8a
docs: update background color and logo
shenxianpeng 5517d80
Update docs/configuration.rst
shenxianpeng 1be91a7
Update docs/configuration.rst
shenxianpeng a9efbac
chore: update bug-report.yml
shenxianpeng 8b7b728
docs: update background to #009485
shenxianpeng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| Changelog | ||
| ========= | ||
|
|
||
| All **notable changes** to this project will be documented in this file. | ||
|
|
||
| Full changelog available at `GitHub releases <https://github.com/commit-check/commit-check/releases>`_. | ||
|
|
||
| v2.0.0 (2025-10-01) | ||
| ------------------- | ||
|
|
||
| .. Attention:: | ||
| This major release introduces significant architectural changes and breaking updates to commit-check. Please review carefully before upgrading. | ||
|
|
||
| What's New | ||
| ~~~~~~~~~~ | ||
|
|
||
| * **TOML Configuration** — Replaces the old ``.commit-check.yml`` with ``cchk.toml`` or ``commit-check.toml`` for clearer syntax. | ||
| * **Simplified CLI & Hooks** — Legacy pre-commit hooks and command-line options have been removed for a cleaner, more consistent interface. | ||
| * **New Validation Engine** — The validation system has been completely redesigned around a new ValidationEngine to improve maintainability and flexibility. | ||
|
|
||
| Breaking Changes | ||
| ^^^^^^^^^^^^^^^^ | ||
|
|
||
| Configuration Format: | ||
|
|
||
| * ``.commit-check.yml`` has been replaced with ``cchk.toml`` or ``commit-check.toml``. | ||
| * All YAML configurations must be migrated to TOML from this version onward. | ||
| * See the `Migration Guide <migration.html>`_ for step-by-step instructions. | ||
|
|
||
| Removed Pre-commit Hooks and CLI Options: | ||
|
|
||
| * Several legacy hooks and command-line flags have been removed in favor of a simplified interface. | ||
| * Removed hooks: ``check-commit-signoff``, ``check-merge-base``, ``check-imperative``. | ||
| * Removed CLI options: ``--signoff``, ``--merge-base``, ``--imperative``. | ||
|
|
||
| Module Removal: | ||
|
|
||
| * The following legacy modules have been removed: ``author.py``, ``branch.py``, ``commit.py``, ``error.py``. | ||
|
|
||
| Architecture Redesign: | ||
|
|
||
| * The validation system has been completely restructured around the new ``ValidationEngine``, breaking compatibility with any code or integrations relying on the old module structure. | ||
|
|
||
| See PR :pr:`280` | ||
|
|
||
| v0.10.2 (2025-08-26) | ||
| -------------------- | ||
|
|
||
| Last release before the big v2.0 changes. | ||
|
|
||
| v0.1.0 (2022-11-02) | ||
| -------------------- | ||
|
|
||
| Initial release of commit-check. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,10 @@ | |
| :hidden: | ||
|
|
||
| self | ||
| what-is-new | ||
| configuration | ||
| migration | ||
| changelog | ||
|
|
||
| .. toctree:: | ||
| :hidden: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,189 @@ | ||
| Migration Guide | ||
| =============== | ||
|
|
||
| This guide helps you migrate from commit-check v1.x (YAML configuration) to v2.0+ (TOML configuration). | ||
|
|
||
| Overview | ||
| -------- | ||
|
|
||
| Version 2.0 introduces significant changes to commit-check: | ||
|
|
||
| * **Configuration format**: ``.commit-check.yml`` → ``cchk.toml`` or ``commit-check.toml`` | ||
| * **Simplified architecture**: New validation engine with cleaner design | ||
| * **Enhanced functionality**: Better error messages and more flexible configuration options | ||
|
|
||
| Quick Migration Steps | ||
| --------------------- | ||
|
|
||
| 1. **Backup your existing configuration**: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| cp .commit-check.yml .commit-check.yml.backup | ||
|
|
||
| 2. **Create new TOML configuration**: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| touch cchk.toml # or commit-check.toml | ||
|
|
||
| 3. **Convert YAML to TOML format** (see examples below) | ||
|
|
||
| 4. **Test the new configuration**: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| commit-check --help | ||
| commit-check --message --branch --author-name --author-email --dry-run | ||
|
|
||
| 5. **Remove old YAML file**: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| rm .commit-check.yml.backup # after confirming everything works | ||
|
|
||
| Configuration Format Changes | ||
| ---------------------------- | ||
|
|
||
| The configuration structure has changed from YAML to TOML format | ||
|
|
||
| YAML (v1.x) vs TOML (v2.0+) | ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| **Old YAML format** (``.commit-check.yml``): | ||
|
|
||
| .. code-block:: yaml | ||
|
|
||
| checks: | ||
| - check: message | ||
| regex: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))?(!)?: ([\w ])+([\s\S]*)|(Merge).*|(fixup!.*)' | ||
| error: "The commit message should be structured as follows:\n\n | ||
| <type>[optional scope]: <description>\n | ||
| [optional body]\n | ||
| [optional footer(s)]\n\n | ||
| More details please refer to https://www.conventionalcommits.org" | ||
| suggest: please check your commit message whether matches above regex | ||
|
|
||
| - check: branch | ||
| regex: ^(bugfix|feature|release|hotfix|task|chore)\/.+|(master)|(main)|(HEAD)|(PR-.+) | ||
| error: "Branches must begin with these types: bugfix/ feature/ release/ hotfix/ task/ chore/" | ||
| suggest: run command `git checkout -b type/branch_name` | ||
|
|
||
| - check: author_name | ||
| regex: ^[A-Za-zÀ-ÖØ-öø-ÿ\u0100-\u017F\u0180-\u024F ,.\'-]+$|.*(\[bot]) | ||
| error: The committer name seems invalid | ||
| suggest: run command `git config user.name "Your Name"` | ||
|
|
||
| - check: author_email | ||
| regex: ^.+@.+$ | ||
| error: The committer email seems invalid | ||
| suggest: run command `git config user.email yourname@example.com` | ||
|
|
||
| - check: commit_signoff | ||
| regex: Signed-off-by:.*[A-Za-z0-9]\s+<.+@.+> | ||
| error: Signed-off-by not found in latest commit | ||
| suggest: run command `git commit -m "conventional commit message" --signoff` | ||
|
|
||
| - check: merge_base | ||
| regex: main # it can be master, develop, devel etc based on your project. | ||
| error: Current branch is not rebased onto target branch | ||
| suggest: Please ensure your branch is rebased with the target branch | ||
|
|
||
| - check: imperative | ||
| regex: '' # Not used for imperative mood check | ||
| error: 'Commit message should use imperative mood (e.g., "Add feature" not "Added feature")' | ||
| suggest: 'Use imperative mood in commit message like "Add", "Fix", "Update", "Remove"' | ||
|
|
||
| **New TOML format** (``cchk.toml`` or ``commit-check.toml``): | ||
|
|
||
| .. code-block:: toml | ||
|
|
||
| [commit] | ||
| # https://www.conventionalcommits.org | ||
| conventional_commits = true | ||
| subject_capitalized = false | ||
| subject_imperative = true | ||
| subject_max_length = 80 | ||
| subject_min_length = 5 | ||
| allow_commit_types = ["feat", "fix", "docs", "style", "refactor", "test", "chore", "ci"] | ||
| allow_merge_commits = true | ||
| allow_revert_commits = true | ||
| allow_empty_commits = false | ||
| allow_fixup_commits = true | ||
| allow_wip_commits = false | ||
| require_body = false | ||
| require_signed_off_by = false | ||
| allow_authors = [] | ||
| ignore_authors = ["dependabot[bot]", "copilot[bot]"] | ||
|
|
||
| [branch] | ||
| # https://conventional-branch.github.io/ | ||
| conventional_branch = true | ||
| allow_branch_types = ["feature", "bugfix", "hotfix", "release", "chore", "feat", "fix"] | ||
| require_rebase_target = "main" | ||
|
|
||
|
|
||
|
|
||
| CLI Changes | ||
| ~~~~~~~~~~~ | ||
|
|
||
| The command-line interface has been simplified: | ||
|
|
||
| **Old CLI** (v1.x): | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| commit-check --config .commit-check.yml | ||
|
|
||
| **New CLI** (v2.0+): | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| commit-check --config cchk.toml # or commit-check.toml | ||
| # Or use defaults (no config file needed) | ||
| commit-check --message --branch | ||
|
|
||
|
|
||
| Troubleshooting | ||
| --------------- | ||
|
|
||
| Common Issues | ||
| ~~~~~~~~~~~~~ | ||
|
|
||
| **Issue**: "Configuration file not found" | ||
|
|
||
| **Solution**: Ensure your file is named ``cchk.toml`` or ``commit-check.toml`` and placed in the repository root. | ||
|
|
||
| **Issue**: "Invalid TOML syntax" | ||
|
|
||
| **Solution**: Use a TOML validator or check the syntax. Common issues include: | ||
|
|
||
| * Missing quotes around strings | ||
| * Incorrect boolean values (use ``true``/``false``, not ``True``/``False``) | ||
| * Invalid array syntax | ||
|
|
||
| **Issue**: "Validation rules not working as expected" | ||
|
|
||
| **Solution**: Check the `Configuration Documentation <configuration.html>`_ for the correct option names and formats. | ||
|
|
||
| Validation and Testing | ||
| ~~~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| After migration, test your configuration: | ||
|
|
||
| .. code-block:: bash | ||
|
|
||
| # Test commit message validation | ||
| echo "feat: test commit message" | commit-check --message | ||
|
|
||
| # Test branch validation | ||
| commit-check --branch | ||
|
|
||
| # Test with dry-run flag | ||
| commit-check --message --branch --author-name --author-email --dry-run | ||
|
|
||
| Getting Help | ||
| ------------ | ||
|
|
||
| * **Documentation**: Check the `Configuration Guide <configuration.html>`_ | ||
| * **Issues**: Report problems on `GitHub Issues <https://github.com/commit-check/commit-check/issues>`_ |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restore sufficient header contrast
Setting the header background to
#009485drops white text contrast to ~3.4:1, below WCAG AA’s 4.5:1 minimum for normal navigation text. Please pick a darker shade or adjust the foreground color so the ratio meets 4.5:1 before landing this.🤖 Prompt for AI Agents