Adding upstream version 0.15.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
d5d4d405a2
commit
c1b4966fba
32 changed files with 87 additions and 66 deletions
|
@ -10,7 +10,7 @@ re-implement these commonly used rules themselves as [user-defined](user_defined
|
|||
To enable certain contrib rules, you can use the `--contrib` flag.
|
||||
```sh
|
||||
$ cat examples/commit-message-1 | gitlint --contrib contrib-title-conventional-commits,CC1
|
||||
1: CC1 Body does not contain a 'Signed-Off-By' line
|
||||
1: CC1 Body does not contain a 'Signed-off-by' line
|
||||
1: CL1 Title does not start with one of fix, feat, chore, docs, style, refactor, perf, test: "WIP: This is the title of a commit message."
|
||||
|
||||
# These are the default violations
|
||||
|
@ -41,7 +41,7 @@ You can also configure contrib rules using [any of the other ways to configure g
|
|||
ID | Name | gitlint version | Description
|
||||
------|-------------------------------------|------------------ |-------------------------------------------
|
||||
CT1 | contrib-title-conventional-commits | >= 0.12.0 | Enforces [Conventional Commits](https://www.conventionalcommits.org/) commit message style on the title.
|
||||
CC1 | contrib-requires-signed-off-by | >= 0.12.0 | Commit body must contain a `Signed-Off-By` line.
|
||||
CC1 | contrib-body-requires-signed-off-by | >= 0.12.0 | Commit body must contain a `Signed-off-by` line.
|
||||
|
||||
## CT1: contrib-title-conventional-commits ##
|
||||
|
||||
|
@ -56,11 +56,11 @@ Name | gitlint version | Default | Description
|
|||
types | >= 0.12.0 | `fix,feat,chore,docs,style,refactor,perf,test,revert,ci,build` | Comma separated list of allowed commit types.
|
||||
|
||||
|
||||
## CC1: contrib-requires-signed-off-by ##
|
||||
## CC1: contrib-body-requires-signed-off-by ##
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|---------------------------------------|--------------------|-------------------------------------------
|
||||
CC1 | contrib-requires-signed-off-by | >= 0.12.0 | Commit body must contain a `Signed-Off-By` line. This means, a line that starts with the `Signed-Off-By` keyword.
|
||||
CC1 | contrib-body-requires-signed-off-by | >= 0.12.0 | Commit body must contain a `Signed-off-by` line. This means, a line that starts with the `Signed-off-by` keyword.
|
||||
|
||||
|
||||
## Contributing Contrib rules
|
||||
|
|
|
@ -2412,7 +2412,7 @@
|
|||
],
|
||||
[
|
||||
0.000020,
|
||||
"gitlint: \u001b[31mYour commit message contains the above violations.\u001b[0m\r\n"
|
||||
"gitlint: \u001b[31mYour commit message contains violations.\u001b[0m\r\n"
|
||||
],
|
||||
[
|
||||
0.002541,
|
||||
|
|
|
@ -17,7 +17,7 @@ T4 | title-hard-tab | >= 0.1.0 | Title cannot contain h
|
|||
T5 | title-must-not-contain-word | >= 0.1.0 | Title cannot contain certain words (default: "WIP")
|
||||
T6 | title-leading-whitespace | >= 0.4.0 | Title cannot have leading whitespace (space or tab)
|
||||
T7 | title-match-regex | >= 0.5.0 | Title must match a given regex (default: None)
|
||||
T8 | title-max-length | >= 0.14.0 | Title length must be > 5 chars.
|
||||
T8 | title-min-length | >= 0.14.0 | Title length must be > 5 chars.
|
||||
B1 | body-max-line-length | >= 0.1.0 | Lines in the body must be < 80 chars
|
||||
B2 | body-trailing-whitespace | >= 0.1.0 | Body cannot have trailing whitespace (space or tab)
|
||||
B3 | body-hard-tab | >= 0.1.0 | Body cannot contain hard tab characters (\t)
|
||||
|
@ -397,9 +397,9 @@ regex | >= 0.14.0 | None | [Pyt
|
|||
[ignore-body-lines]
|
||||
regex=^Co-Authored-By
|
||||
|
||||
# Ignore lines that start with 'Co-Authored-By' or with 'Signed-Off-By'
|
||||
# Ignore lines that start with 'Co-Authored-By' or with 'Signed-off-by'
|
||||
[ignore-body-lines]
|
||||
regex=(^Co-Authored-By)|(^Signed-Off-By)
|
||||
regex=(^Co-Authored-By)|(^Signed-off-by)
|
||||
|
||||
# Ignore lines that contain 'foobar'
|
||||
[ignore-body-lines]
|
||||
|
|
|
@ -9,8 +9,8 @@ for python files containing gitlint rule classes. You can also specify a single
|
|||
|
||||
```sh
|
||||
cat examples/commit-message-1 | gitlint --extra-path examples/
|
||||
# Example output of a user-defined Signed-Off-By rule
|
||||
1: UC2 Body does not contain a 'Signed-Off-By Line'
|
||||
# Example output of a user-defined Signed-off-by rule
|
||||
1: UC2 Body does not contain a 'Signed-off-by Line'
|
||||
# other violations were removed for brevity
|
||||
```
|
||||
|
||||
|
@ -23,9 +23,9 @@ which is part of the examples directory that was passed via `--extra-path`:
|
|||
from gitlint.rules import CommitRule, RuleViolation
|
||||
|
||||
class SignedOffBy(CommitRule):
|
||||
""" This rule will enforce that each commit contains a "Signed-Off-By" line.
|
||||
""" This rule will enforce that each commit contains a "Signed-off-by" line.
|
||||
We keep things simple here and just check whether the commit body contains a
|
||||
line that starts with "Signed-Off-By".
|
||||
line that starts with "Signed-off-by".
|
||||
"""
|
||||
|
||||
# A rule MUST have a human friendly name
|
||||
|
@ -39,10 +39,10 @@ class SignedOffBy(CommitRule):
|
|||
self.log.debug("SignedOffBy: This will be visible when running `gitlint --debug`")
|
||||
|
||||
for line in commit.message.body:
|
||||
if line.startswith("Signed-Off-By"):
|
||||
if line.startswith("Signed-off-by"):
|
||||
return
|
||||
|
||||
msg = "Body does not contain a 'Signed-Off-By' line"
|
||||
msg = "Body does not contain a 'Signed-off-by' line"
|
||||
return [RuleViolation(self.id, msg, line_nr=1)]
|
||||
```
|
||||
|
||||
|
@ -95,9 +95,9 @@ Consider the following `CommitRule` that can be found in [examples/my_commit_rul
|
|||
from gitlint.rules import CommitRule, RuleViolation
|
||||
|
||||
class SignedOffBy(CommitRule):
|
||||
""" This rule will enforce that each commit contains a "Signed-Off-By" line.
|
||||
""" This rule will enforce that each commit contains a "Signed-off-by" line.
|
||||
We keep things simple here and just check whether the commit body contains a
|
||||
line that starts with "Signed-Off-By".
|
||||
line that starts with "Signed-off-by".
|
||||
"""
|
||||
|
||||
# A rule MUST have a human friendly name
|
||||
|
@ -111,10 +111,10 @@ class SignedOffBy(CommitRule):
|
|||
self.log.debug("SignedOffBy: This will be visible when running `gitlint --debug`")
|
||||
|
||||
for line in commit.message.body:
|
||||
if line.startswith("Signed-Off-By"):
|
||||
if line.startswith("Signed-off-by"):
|
||||
return
|
||||
|
||||
msg = "Body does not contain a 'Signed-Off-By' line"
|
||||
msg = "Body does not contain a 'Signed-off-by' line"
|
||||
return [RuleViolation(self.id, msg, line_nr=1)]
|
||||
```
|
||||
Note the use of the `name` and `id` class attributes and the `validate(...)` method taking a single `commit` parameter.
|
||||
|
@ -368,7 +368,7 @@ class ReleaseConfigurationRule(ConfigurationRule):
|
|||
# NOT modify your actual commit in git)
|
||||
commit.message.body = [line for line in commit.message.body if not line.startswith("$")]
|
||||
|
||||
# You can add any extra properties you want to the commit object,
|
||||
# You can add any extra properties you want to the commit object,
|
||||
# these will be available later on in all rules.
|
||||
commit.my_property = "This is my property"
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue