-
-
Notifications
You must be signed in to change notification settings - Fork 8
BREAKING CHANGE: Configuration Migration and Removed Features #280
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
Changes from all commits
2f232b8
251797b
14daa97
b34ed02
2f95c58
7229ed6
76cc6e3
decded8
66860c9
143803c
485bc28
6d4cc18
0e3e604
bc89a4a
fd7e123
f484cbb
834c394
050beae
da60df4
16c82da
de94d3f
74b7ef8
d19a915
8f56396
6ca70f3
76159a7
5616cb3
4f82871
699f43c
6b6c2e2
c116654
68afa23
bc700e2
882e39d
b43a3ef
56299b1
643a1a7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,23 @@ | ||||||
| [commit] | ||||||
| # https://www.conventionalcommits.org | ||||||
| conventional_commits = true | ||||||
| subject_capitalized = false | ||||||
| subject_imperative = true | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use ‘imperative’ key to match engine/rule_builder. Current ‘subject_imperative’ is ignored by engine; rename to imperative. -subject_imperative = true
+imperative = true📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @coderabbitai The option should still be
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: Length of output: 3255 🏁 Script executed: Length of output: 1537 🏁 Script executed: Length of output: 613 🏁 Script executed: Length of output: 2674 @shenxianpeng, I've verified the implementation, and I need to clarify the situation. There's actually an inconsistency in the codebase that affects this: The config key should be
What happens with
To verify this is working correctly, you should:
The original suggestion to rename to |
||||||
| subject_max_length = 50 | ||||||
| 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" | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,73 +1,29 @@ | ||
| """The commit-check package's base module.""" | ||
| from importlib.metadata import version | ||
| """The commit-check package's base module. | ||
|
|
||
| RED = '\033[0;31m' | ||
| GREEN = "\033[32m" | ||
| YELLOW = '\033[93m' | ||
| RESET_COLOR = '\033[0m' | ||
| Exports: | ||
| PASS / FAIL exit codes | ||
| DEFAULT_CONFIG: minimal default rule set used when no config found | ||
| ANSI color constants | ||
| __version__ (package version) | ||
| """ | ||
|
|
||
| from importlib.metadata import version | ||
| from commit_check.rule_builder import RuleBuilder | ||
|
|
||
| # Exit codes used across the package | ||
| PASS = 0 | ||
| FAIL = 1 | ||
|
|
||
| """ | ||
| Use default config if .commit-check.yml not exist. | ||
| """ | ||
| DEFAULT_CONFIG = { | ||
| 'checks': [ | ||
| { | ||
| 'check': 'message', | ||
| 'regex': r'^(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': r'^(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': r'^[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': r'^.+@.+$', | ||
| 'error': 'The committer\'s email seems invalid', | ||
| 'suggest': 'run command `git config user.email yourname@example.com`', | ||
| }, | ||
| { | ||
| 'check': 'commit_signoff', | ||
| 'regex': r'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': r'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': r'', # 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"', | ||
| }, | ||
| ], | ||
| } | ||
|
|
||
|
|
||
| """ | ||
| Overwrite DEFAULT_CONFIG if `.commit-check.yml` exist. | ||
| """ | ||
| # ANSI color codes used for CLI output | ||
| RED = "\033[91m" | ||
| GREEN = "\033[92m" | ||
| YELLOW = "\033[93m" | ||
| RESET_COLOR = "\033[0m" | ||
|
|
||
| CONFIG_FILE = '.commit-check.yml' | ||
| # Default (empty) configuration translated into internal checks structure | ||
| _rule_builder = RuleBuilder({}) | ||
| _default_rules = _rule_builder.build_all_rules() | ||
| DEFAULT_CONFIG = {"checks": [rule.to_dict() for rule in _default_rules]} | ||
|
|
||
| CONFIG_FILE = "." # Search current directory for commit-check.toml or cchk.toml | ||
| __version__ = version("commit-check") |
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.