chore: harmonize gitlint with commitlint standards
- Enforce lowercase descriptions and proper scope validation - Expand automated commit ignoring for merge/revert/fixup - Update pre-commit CI messages to conventional format - Improve documentation with validation examples
This commit is contained in:
parent
f3a1cf62fc
commit
9fc67c4674
3 changed files with 27 additions and 19 deletions
28
.gitlint
28
.gitlint
|
@ -1,15 +1,20 @@
|
|||
# Gitlint configuration file
|
||||
# See https://jorisroovers.github.io/gitlint/configuration/ for documentation
|
||||
# This configuration enforces conventional commit message format
|
||||
# This configuration enforces conventional commit message format aligned with commitlint standards
|
||||
|
||||
[general]
|
||||
# Ignore specific rules if needed
|
||||
# Ignore specific rules - body is optional in conventional commits
|
||||
ignore=body-changed-file-mention,body-match-regex,body-is-missing
|
||||
# Enable search regex style to avoid warnings
|
||||
regex-style-search=true
|
||||
# Ignore merge commits and other automated commits
|
||||
ignore-merge-commits=true
|
||||
ignore-revert-commits=true
|
||||
ignore-fixup-commits=true
|
||||
ignore-squash-commits=true
|
||||
|
||||
[title-max-length]
|
||||
# Maximum title length
|
||||
# Maximum title length (50 is best practice for readability)
|
||||
line-length=50
|
||||
|
||||
[title-must-not-contain-word]
|
||||
|
@ -18,26 +23,25 @@ words=WIP,TODO,FIXME
|
|||
|
||||
[title-match-regex]
|
||||
# Title must match conventional commit format
|
||||
regex=^(feat|fix|docs|style|refactor|test|chore|ci|build|perf|revert)(\(.+\))?: .+
|
||||
# Supports optional scope and enforces lowercase types
|
||||
regex=^(feat|fix|docs|style|refactor|test|chore|ci|build|perf|revert)(\([a-z0-9-]+\))?: [a-z].+
|
||||
|
||||
[body-max-line-length]
|
||||
# Maximum line length in the body
|
||||
# Maximum line length in the body (commitlint standard)
|
||||
line-length=72
|
||||
|
||||
[body-min-length]
|
||||
# Minimum body length (0 = no minimum)
|
||||
# Minimum body length (0 = no minimum, body is optional)
|
||||
min-length=0
|
||||
|
||||
# Body is optional - disabled via ignore list above
|
||||
|
||||
[ignore-by-title]
|
||||
# Ignore specific commit titles
|
||||
regex=(Merge|Revert|Initial commit)
|
||||
# Ignore specific commit titles (aligned with commitlint defaults)
|
||||
regex=(Merge|Revert|Initial commit|Bump|Release|Version)
|
||||
|
||||
[ignore-by-body]
|
||||
# Ignore specific commit bodies
|
||||
regex=(Signed-off-by|Co-authored-by)
|
||||
|
||||
[ignore-by-author-name]
|
||||
# Ignore commits by specific authors
|
||||
regex=(dependabot|renovate)
|
||||
# Ignore commits by specific authors (bots and automated tools)
|
||||
regex=(dependabot|renovate|github-actions|pre-commit)
|
||||
|
|
|
@ -15,7 +15,7 @@ repos:
|
|||
- id: check-json
|
||||
- id: check-toml
|
||||
- id: mixed-line-ending
|
||||
args: ['--fix=lf']
|
||||
args: ["--fix=lf"]
|
||||
|
||||
# Python code formatting and linting
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
|
@ -43,12 +43,12 @@ repos:
|
|||
# Configuration for specific hooks
|
||||
ci:
|
||||
autofix_commit_msg: |
|
||||
[pre-commit.ci] auto fixes from pre-commit hooks
|
||||
chore(deps): auto fixes from pre-commit hooks
|
||||
|
||||
for more information, see https://pre-commit.ci
|
||||
autofix_prs: true
|
||||
autoupdate_branch: ''
|
||||
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
|
||||
autoupdate_branch: ""
|
||||
autoupdate_commit_msg: "chore(deps): pre-commit autoupdate"
|
||||
autoupdate_schedule: weekly
|
||||
skip: []
|
||||
submodules: false
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Git Commit Message Linting
|
||||
===========================
|
||||
|
||||
This project uses `gitlint <https://jorisroovers.github.io/gitlint/>`_ to enforce consistent commit message formatting. All commit messages must follow the `Conventional Commits <https://www.conventionalcommits.org/>`_ specification to ensure clear and standardized project history.
|
||||
This project uses `gitlint <https://jorisroovers.github.io/gitlint/>`_ to enforce consistent commit message formatting. All commit messages must follow the `Conventional Commits <https://www.conventionalcommits.org/>`_ specification to ensure clear and standardized project history. The configuration is harmonized with commitlint standards for maximum compatibility.
|
||||
|
||||
Why Commit Message Standards Matter
|
||||
-----------------------------------
|
||||
|
@ -126,10 +126,11 @@ Configuration
|
|||
The project uses a ``.gitlint`` configuration file that enforces:
|
||||
|
||||
* Maximum title length of 50 characters
|
||||
* Conventional commit format validation
|
||||
* Conventional commit format validation with lowercase descriptions
|
||||
* Maximum body line length of 72 characters
|
||||
* Exclusion of certain words like "WIP", "TODO", "FIXME" in titles
|
||||
* Automatic ignoring of merge commits and dependency updates
|
||||
* Automatic ignoring of merge commits, reverts, fixups, and automated commits
|
||||
* Scope validation with lowercase alphanumeric characters and hyphens
|
||||
|
||||
Linting Tools
|
||||
-------------
|
||||
|
@ -220,6 +221,9 @@ Common Validation Errors
|
|||
**Capitalized description**
|
||||
Don't capitalize the first letter of the description: ``feat: add feature`` not ``feat: Add feature``
|
||||
|
||||
**Invalid scope format**
|
||||
Use only lowercase letters, numbers, and hyphens in scopes: ``feat(api-v2): add feature`` not ``feat(API_V2): add feature``
|
||||
|
||||
**Trailing period**
|
||||
Don't add a period at the end of the title: ``feat: add feature`` not ``feat: add feature.``
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue