Merging upstream version 0.18.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
0453b640a2
commit
129d2ce1fc
118 changed files with 4146 additions and 2087 deletions
|
@ -11,7 +11,7 @@ gitlint generate-config
|
|||
You can also use a different config file like so:
|
||||
|
||||
```sh
|
||||
gitlint --config myconfigfile.ini
|
||||
gitlint --config myconfigfile.ini
|
||||
```
|
||||
|
||||
The block below shows a sample `.gitlint` file. Details about rule config options can be found on the
|
||||
|
@ -39,16 +39,17 @@ ignore=title-trailing-punctuation, T3
|
|||
# precedence over this
|
||||
verbosity = 2
|
||||
|
||||
# By default gitlint will ignore merge, revert, fixup and squash commits.
|
||||
# By default gitlint will ignore merge, revert, fixup, fixup=amend, and squash commits.
|
||||
ignore-merge-commits=true
|
||||
ignore-revert-commits=true
|
||||
ignore-fixup-commits=true
|
||||
ignore-fixup-amend-commits=true
|
||||
ignore-squash-commits=true
|
||||
|
||||
# Ignore any data send to gitlint via stdin
|
||||
# Ignore any data sent to gitlint via stdin
|
||||
ignore-stdin=true
|
||||
|
||||
# Fetch additional meta-data from the local repository when manually passing a
|
||||
# Fetch additional meta-data from the local repository when manually passing a
|
||||
# commit message to gitlint via stdin or --commit-msg. Disabled by default.
|
||||
staged=true
|
||||
|
||||
|
@ -58,6 +59,11 @@ staged=true
|
|||
# Disabled by default.
|
||||
fail-without-commits=true
|
||||
|
||||
# Whether to use Python `search` instead of `match` semantics in rules that use
|
||||
# regexes. Context: https://github.com/jorisroovers/gitlint/issues/254
|
||||
# Disabled by default, but will be enabled by default in the future.
|
||||
regex-style-search=true
|
||||
|
||||
# Enable debug mode (prints more output). Disabled by default.
|
||||
debug=true
|
||||
|
||||
|
@ -187,7 +193,7 @@ gitlint-ignore: all
|
|||
|
||||
`gitlint-ignore: all` can occur on any line, as long as it is at the start of the line.
|
||||
|
||||
You can also specify specific rules to be ignored as follows:
|
||||
You can also specify specific rules to be ignored as follows:
|
||||
```
|
||||
WIP: This is my commit message
|
||||
|
||||
|
@ -201,7 +207,7 @@ gitlint-ignore: T1, body-hard-tab
|
|||
gitlint configuration is applied in the following order of precedence:
|
||||
|
||||
1. Commit specific config (e.g.: `gitlint-ignore: all` in the commit message)
|
||||
2. Configuration Rules (e.g.: [ignore-by-title](/rules/#i1-ignore-by-title))
|
||||
2. Configuration Rules (e.g.: [ignore-by-title](rules.md#i1-ignore-by-title))
|
||||
3. Commandline convenience flags (e.g.: `-vv`, `--silent`, `--ignore`)
|
||||
4. Environment variables (e.g.: `GITLINT_VERBOSITY=3`)
|
||||
5. Commandline configuration flags (e.g.: `-c title-max-length=123`)
|
||||
|
@ -216,9 +222,9 @@ using commandline flags or in `[general]` section in a `.gitlint` configuration
|
|||
|
||||
Enable silent mode (no output). Use [exit](index.md#exit-codes) code to determine result.
|
||||
|
||||
Default value | gitlint version | commandline flag | environment variable
|
||||
---------------|------------------|-------------------|-----------------------
|
||||
`False` | >= 0.1.0 | `--silent` | `GITLINT_SILENT`
|
||||
| Default value | gitlint version | commandline flag | environment variable |
|
||||
| ------------- | --------------- | ---------------- | -------------------- |
|
||||
| `False` | >= 0.1.0 | `--silent` | `GITLINT_SILENT` |
|
||||
|
||||
#### Examples
|
||||
```sh
|
||||
|
@ -226,14 +232,15 @@ Default value | gitlint version | commandline flag | environment variable
|
|||
gitlint --silent
|
||||
GITLINT_SILENT=1 gitlint # using env variable
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
### verbosity
|
||||
|
||||
Amount of output gitlint will show when printing errors.
|
||||
|
||||
Default value | gitlint version | commandline flag | environment variable
|
||||
---------------|------------------|-------------------|-----------------------
|
||||
3 | >= 0.1.0 | `-v` | `GITLINT_VERBOSITY`
|
||||
| Default value | gitlint version | commandline flag | environment variable |
|
||||
| ------------- | --------------- | ---------------- | -------------------- |
|
||||
| 3 | >= 0.1.0 | `-v` | `GITLINT_VERBOSITY` |
|
||||
|
||||
|
||||
#### Examples
|
||||
|
@ -252,14 +259,15 @@ GITLINT_VERBOSITY=2 gitlint # using env variable
|
|||
[general]
|
||||
verbosity=2
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
### ignore
|
||||
|
||||
Comma separated list of rules to ignore (by name or id).
|
||||
|
||||
Default value | gitlint version | commandline flag | environment variable
|
||||
---------------------------|------------------|-------------------|-----------------------
|
||||
[] (=empty list) | >= 0.1.0 | `--ignore` | `GITLINT_IGNORE`
|
||||
| Default value | gitlint version | commandline flag | environment variable |
|
||||
| ---------------- | --------------- | ---------------- | -------------------- |
|
||||
| [] (=empty list) | >= 0.1.0 | `--ignore` | `GITLINT_IGNORE` |
|
||||
|
||||
#### Examples
|
||||
```sh
|
||||
|
@ -274,14 +282,15 @@ GITLINT_IGNORE=T1,body-min-length gitlint # using env variable
|
|||
[general]
|
||||
ignore=T1,body-min-length
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
### debug
|
||||
|
||||
Enable debugging output.
|
||||
|
||||
Default value | gitlint version | commandline flag | environment variable
|
||||
---------------|------------------|-------------------|-----------------------
|
||||
false | >= 0.7.1 | `--debug` | `GITLINT_DEBUG`
|
||||
| Default value | gitlint version | commandline flag | environment variable |
|
||||
| ------------- | --------------- | ---------------- | -------------------- |
|
||||
| false | >= 0.7.1 | `--debug` | `GITLINT_DEBUG` |
|
||||
|
||||
#### Examples
|
||||
```sh
|
||||
|
@ -291,14 +300,15 @@ GITLINT_DEBUG=1 gitlint # using env variable
|
|||
# --debug is special, the following does NOT work
|
||||
# gitlint -c general.debug=true
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
### target
|
||||
|
||||
Target git repository gitlint should be linting against.
|
||||
|
||||
Default value | gitlint version | commandline flag | environment variable
|
||||
---------------------------|------------------|-------------------|-----------------------
|
||||
(empty) | >= 0.8.0 | `--target` | `GITLINT_TARGET`
|
||||
| Default value | gitlint version | commandline flag | environment variable |
|
||||
| ------------- | --------------- | ---------------- | -------------------- |
|
||||
| (empty) | >= 0.8.0 | `--target` | `GITLINT_TARGET` |
|
||||
|
||||
#### Examples
|
||||
```sh
|
||||
|
@ -312,14 +322,31 @@ GITLINT_TARGET=/home/joe/myrepo/ gitlint # using env variable
|
|||
[general]
|
||||
target=/home/joe/myrepo/
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
### config
|
||||
|
||||
Path where gitlint looks for a config file.
|
||||
|
||||
| Default value | gitlint version | commandline flag | environment variable |
|
||||
| ------------- | --------------- | ---------------- | -------------------- |
|
||||
| `.gitlint` | >= 0.1.0 | `--config` | `GITLINT_CONFIG` |
|
||||
|
||||
#### Examples
|
||||
```sh
|
||||
gitlint --config=/home/joe/gitlint.ini
|
||||
gitlint -C /home/joe/gitlint.ini # different way of doing the same
|
||||
GITLINT_CONFIG=/home/joe/gitlint.ini # using env variable
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
### extra-path
|
||||
|
||||
Path where gitlint looks for [user-defined rules](user_defined_rules.md).
|
||||
|
||||
Default value | gitlint version | commandline flag | environment variable
|
||||
---------------------------|------------------|-------------------|-----------------------
|
||||
(empty) | >= 0.8.0 | `--extra-path` | `GITLINT_EXTRA_PATH`
|
||||
| Default value | gitlint version | commandline flag | environment variable |
|
||||
| ------------- | --------------- | ---------------- | -------------------- |
|
||||
| (empty) | >= 0.8.0 | `--extra-path` | `GITLINT_EXTRA_PATH` |
|
||||
|
||||
#### Examples
|
||||
```sh
|
||||
|
@ -333,14 +360,14 @@ GITLINT_EXTRA_PATH=/home/joe/rules/ gitlint # using env variable
|
|||
[general]
|
||||
extra-path=/home/joe/rules/
|
||||
```
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
### contrib
|
||||
|
||||
Comma-separated list of [Contrib rules](contrib_rules) to enable (by name or id).
|
||||
Comma-separated list of [Contrib rules](contrib_rules.md) to enable (by name or id).
|
||||
|
||||
Default value | gitlint version | commandline flag | environment variable
|
||||
---------------------------|------------------|-------------------|-----------------------
|
||||
(empty) | >= 0.12.0 | `--contrib` | `GITLINT_CONTRIB`
|
||||
| Default value | gitlint version | commandline flag | environment variable |
|
||||
| ------------- | --------------- | ---------------- | -------------------- |
|
||||
| (empty) | >= 0.12.0 | `--contrib` | `GITLINT_CONTRIB` |
|
||||
|
||||
#### Examples
|
||||
```sh
|
||||
|
@ -349,21 +376,31 @@ gitlint --contrib=contrib-title-conventional-commits,CC1
|
|||
# different way of doing the same
|
||||
gitlint -c general.contrib=contrib-title-conventional-commits,CC1
|
||||
# using env variable
|
||||
GITLINT_CONTRIB=contrib-title-conventional-commits,CC1 gitlint
|
||||
GITLINT_CONTRIB=contrib-title-conventional-commits,CC1 gitlint
|
||||
```
|
||||
```ini
|
||||
#.gitlint
|
||||
[general]
|
||||
contrib=contrib-title-conventional-commits,CC1
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
### staged
|
||||
|
||||
Fetch additional meta-data from the local repository when manually passing a commit message to gitlint via stdin or `--commit-msg`.
|
||||
Attempt smart guesses about meta info (like author name, email, branch, changed files, etc) when manually passing a
|
||||
commit message to gitlint via stdin or `--commit-msg`.
|
||||
|
||||
Default value | gitlint version | commandline flag | environment variable
|
||||
---------------|------------------|-------------------|-----------------------
|
||||
false | >= 0.13.0 | `--staged` | `GITLINT_STAGED`
|
||||
Since in such cases no actual git commit exists (yet) for the message being linted, gitlint
|
||||
needs to apply some heuristics (like checking `git config` and any staged changes) to make a smart guess about what the
|
||||
likely author name, email, commit date, changed files and branch of the ensuing commit would be.
|
||||
|
||||
When not using the `--staged` flag while linting a commit message via stdin or `--commit-msg`, gitlint will only have
|
||||
access to the commit message itself for linting and won't be able to enforce rules like
|
||||
[M1:author-valid-email](rules.md#m1-author-valid-email).
|
||||
|
||||
| Default value | gitlint version | commandline flag | environment variable |
|
||||
| ------------- | --------------- | ---------------- | -------------------- |
|
||||
| false | >= 0.13.0 | `--staged` | `GITLINT_STAGED` |
|
||||
|
||||
#### Examples
|
||||
```sh
|
||||
|
@ -377,6 +414,7 @@ GITLINT_STAGED=1 gitlint # using env variable
|
|||
[general]
|
||||
staged=true
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
### fail-without-commits
|
||||
|
||||
|
@ -384,15 +422,15 @@ Hard fail when the target commit range is empty. Note that gitlint will
|
|||
already fail by default on invalid commit ranges. This option is specifically
|
||||
to tell gitlint to fail on **valid but empty** commit ranges.
|
||||
|
||||
Default value | gitlint version | commandline flag | environment variable
|
||||
---------------|------------------|---------------------------|-----------------------
|
||||
false | >= 0.15.2 | `--fail-without-commits` | `GITLINT_FAIL_WITHOUT_COMMITS`
|
||||
| Default value | gitlint version | commandline flag | environment variable |
|
||||
| ------------- | --------------- | ------------------------ | ------------------------------ |
|
||||
| false | >= 0.15.2 | `--fail-without-commits` | `GITLINT_FAIL_WITHOUT_COMMITS` |
|
||||
|
||||
#### Examples
|
||||
```sh
|
||||
# CLI
|
||||
# The following will cause gitlint to hard fail (i.e. exit code > 0)
|
||||
# since HEAD..HEAD is a valid but empty commit range.
|
||||
# since HEAD..HEAD is a valid but empty commit range.
|
||||
gitlint --fail-without-commits --commits HEAD..HEAD
|
||||
GITLINT_FAIL_WITHOUT_COMMITS=1 gitlint # using env variable
|
||||
```
|
||||
|
@ -402,13 +440,79 @@ GITLINT_FAIL_WITHOUT_COMMITS=1 gitlint # using env variable
|
|||
fail-without-commits=true
|
||||
```
|
||||
|
||||
---
|
||||
### regex-style-search
|
||||
|
||||
Whether to use Python `re.search()` instead of `re.match()` semantics in all built-in rules that use regular expressions.
|
||||
|
||||
| Default value | gitlint version | commandline flag | environment variable |
|
||||
| ------------- | --------------- | ---------------- | -------------------- |
|
||||
| false | >= 0.18.0 | Not Available | Not Available |
|
||||
|
||||
!!! important
|
||||
At this time, `regex-style-search` is **disabled** by default, but it will be **enabled** by default in the future.
|
||||
|
||||
|
||||
|
||||
Gitlint will log a warning when you're using a rule that uses a custom regex and this option is not enabled:
|
||||
|
||||
```plain
|
||||
WARNING: I1 - ignore-by-title: gitlint will be switching from using Python regex 'match' (match beginning) to
|
||||
'search' (match anywhere) semantics. Please review your ignore-by-title.regex option accordingly.
|
||||
To remove this warning, set general.regex-style-search=True.
|
||||
More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
|
||||
```
|
||||
|
||||
*If you don't have any custom regex specified, gitlint will not log a warning and no action is needed.*
|
||||
|
||||
**To remove the warning:**
|
||||
|
||||
1. Review your regex in the rules gitlint warned for and ensure it's still accurate when using [`re.search()` semantics](https://docs.python.org/3/library/re.html#search-vs-match).
|
||||
2. Enable `regex-style-search` in your `.gitlint` file (or using [any other way to configure gitlint](http://127.0.0.1:8000/gitlint/configuration/)):
|
||||
|
||||
```ini
|
||||
[general]
|
||||
regex-style-search=true
|
||||
```
|
||||
|
||||
#### More context
|
||||
Python offers [two different primitive operations based on regular expressions](https://docs.python.org/3/library/re.html#search-vs-match):
|
||||
`re.match()` checks for a match only at the beginning of the string, while `re.search()` checks for a match anywhere
|
||||
in the string.
|
||||
|
||||
|
||||
|
||||
Most rules in gitlint already use `re.search()` instead of `re.match()`, but there's a few notable exceptions that
|
||||
use `re.match()`, which can lead to unexpected matching behavior.
|
||||
|
||||
- M1 - author-valid-email
|
||||
- I1 - ignore-by-title
|
||||
- I2 - ignore-by-body
|
||||
- I3 - ignore-body-lines
|
||||
- I4 - ignore-by-author-name
|
||||
|
||||
The `regex-style-search` option is meant to fix this inconsistency. Setting it to `true` will force the above rules to
|
||||
use `re.search()` instead of `re.match()`. For detailed context, see [issue #254](https://github.com/jorisroovers/gitlint/issues/254).
|
||||
|
||||
|
||||
#### Examples
|
||||
```sh
|
||||
# CLI
|
||||
gitlint -c general.regex-style-search=true
|
||||
```
|
||||
```ini
|
||||
#.gitlint
|
||||
[general]
|
||||
regex-style-search=true
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
### ignore-stdin
|
||||
|
||||
Ignore any stdin data. Sometimes useful when running gitlint in a CI server.
|
||||
|
||||
Default value | gitlint version | commandline flag | environment variable
|
||||
---------------|------------------|-------------------|-----------------------
|
||||
false | >= 0.12.0 | `--ignore-stdin` | `GITLINT_IGNORE_STDIN`
|
||||
| Default value | gitlint version | commandline flag | environment variable |
|
||||
| ------------- | --------------- | ---------------- | ---------------------- |
|
||||
| false | >= 0.12.0 | `--ignore-stdin` | `GITLINT_IGNORE_STDIN` |
|
||||
|
||||
#### Examples
|
||||
```sh
|
||||
|
@ -422,14 +526,15 @@ GITLINT_IGNORE_STDIN=1 gitlint # using env variable
|
|||
[general]
|
||||
ignore-stdin=true
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
### ignore-merge-commits
|
||||
|
||||
Whether or not to ignore merge commits.
|
||||
|
||||
Default value | gitlint version | commandline flag | environment variable
|
||||
---------------|------------------|-------------------|-----------------------
|
||||
true | >= 0.7.0 | Not Available | Not Available
|
||||
| Default value | gitlint version | commandline flag | environment variable |
|
||||
| ------------- | --------------- | ---------------- | -------------------- |
|
||||
| true | >= 0.7.0 | Not Available | Not Available |
|
||||
|
||||
#### Examples
|
||||
```sh
|
||||
|
@ -441,14 +546,15 @@ gitlint -c general.ignore-merge-commits=false
|
|||
[general]
|
||||
ignore-merge-commits=false
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
### ignore-revert-commits
|
||||
|
||||
Whether or not to ignore revert commits.
|
||||
|
||||
Default value | gitlint version | commandline flag | environment variable
|
||||
---------------|------------------|-------------------|-----------------------
|
||||
true | >= 0.13.0 | Not Available | Not Available
|
||||
| Default value | gitlint version | commandline flag | environment variable |
|
||||
| ------------- | --------------- | ---------------- | -------------------- |
|
||||
| true | >= 0.13.0 | Not Available | Not Available |
|
||||
|
||||
#### Examples
|
||||
```sh
|
||||
|
@ -460,14 +566,15 @@ gitlint -c general.ignore-revert-commits=false
|
|||
[general]
|
||||
ignore-revert-commits=false
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
### ignore-fixup-commits
|
||||
|
||||
Whether or not to ignore [fixup](https://git-scm.com/docs/git-commit#git-commit---fixupltcommitgt) commits.
|
||||
|
||||
Default value | gitlint version | commandline flag | environment variable
|
||||
---------------|------------------|-------------------|-----------------------
|
||||
true | >= 0.9.0 | Not Available | Not Available
|
||||
| Default value | gitlint version | commandline flag | environment variable |
|
||||
| ------------- | --------------- | ---------------- | -------------------- |
|
||||
| true | >= 0.9.0 | Not Available | Not Available |
|
||||
|
||||
#### Examples
|
||||
```sh
|
||||
|
@ -479,14 +586,35 @@ gitlint -c general.ignore-fixup-commits=false
|
|||
[general]
|
||||
ignore-fixup-commits=false
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
### ignore-fixup-amend-commits
|
||||
|
||||
Whether or not to ignore [fixup=amend](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---fixupamendrewordltcommitgt) commits.
|
||||
|
||||
| Default value | gitlint version | commandline flag | environment variable |
|
||||
| ------------- | --------------- | ---------------- | -------------------- |
|
||||
| true | >= 0.18.0 | Not Available | Not Available |
|
||||
|
||||
#### Examples
|
||||
```sh
|
||||
# CLI
|
||||
gitlint -c general.ignore-fixup-amend-commits=false
|
||||
```
|
||||
```ini
|
||||
#.gitlint
|
||||
[general]
|
||||
ignore-fixup-amend-commits=false
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
### ignore-squash-commits
|
||||
|
||||
Whether or not to ignore [squash](https://git-scm.com/docs/git-commit#git-commit---squashltcommitgt) commits.
|
||||
|
||||
Default value | gitlint version | commandline flag | environment variable
|
||||
---------------|------------------|-------------------|-----------------------
|
||||
true | >= 0.9.0 | Not Available | Not Available
|
||||
| Default value | gitlint version | commandline flag | environment variable |
|
||||
| ------------- | --------------- | ---------------- | -------------------- |
|
||||
| true | >= 0.9.0 | Not Available | Not Available |
|
||||
|
||||
#### Examples
|
||||
```sh
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
# Using Contrib Rules
|
||||
|
||||
_Introduced in gitlint v0.12.0_
|
||||
|
||||
Contrib rules are community-**contrib**uted rules that are disabled by default, but can be enabled through configuration.
|
||||
|
||||
Contrib rules are meant to augment default gitlint behavior by providing users with rules for common use-cases without
|
||||
forcing these rules on all gitlint users. This also means that users don't have to
|
||||
re-implement these commonly used rules themselves as [user-defined](user_defined_rules) rules.
|
||||
re-implement these commonly used rules themselves as [user-defined](user_defined_rules.md) rules.
|
||||
|
||||
To enable certain contrib rules, you can use the `--contrib` flag.
|
||||
```sh
|
||||
|
@ -42,6 +43,8 @@ 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-body-requires-signed-off-by | >= 0.12.0 | Commit body must contain a `Signed-off-by` line.
|
||||
CC2 | contrib-disallow-cleanup-commits | >= 0.18.0 | Commit title must not contain `fixup!`, `squash!`, `amend!`.
|
||||
CC3 | contrib-allowed-authors | >= 0.18.0 | Enforce that only authors listed in the `AUTHORS` file are allowed to commit.
|
||||
|
||||
## CT1: contrib-title-conventional-commits ##
|
||||
|
||||
|
@ -63,5 +66,18 @@ ID | Name | gitlint version | Description
|
|||
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.
|
||||
|
||||
|
||||
## CC2: contrib-disallow-cleanup-commits ##
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|----------------------------------|--------------------|-------------------------------------------
|
||||
CC2 | contrib-disallow-cleanup-commits | >= 0.18.0 | Commit title must not contain `fixup!`, `squash!` or `amend!`. This means `git commit --fixup` and `git commit --squash` commits are not allowed.
|
||||
|
||||
## CC3: contrib-allowed-authors ##
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|----------------------------------|--------------------|-------------------------------------------
|
||||
CC3 | contrib-allowed-authors | >= 0.18.0 | The commit author must be listed in an `AUTHORS` file to be allowed to commit. Possible file names are also `AUTHORS.txt` and `AUTHORS.md`.
|
||||
|
||||
## Contributing Contrib rules
|
||||
We'd love for you to contribute new Contrib rules to gitlint or improve existing ones! Please visit the [Contributing](contributing) page on how to get started.
|
||||
|
||||
We'd love for you to contribute new Contrib rules to gitlint or improve existing ones! Please visit the [Contributing](contributing.md) page on how to get started.
|
||||
|
|
|
@ -6,7 +6,7 @@ The [source-code and issue tracker](https://github.com/jorisroovers/gitlint) are
|
|||
Often it takes a while for us (well, actually just [me](https://github.com/jorisroovers)) to get back to you
|
||||
(sometimes up to a few months, this is a hobby project), but rest assured that we read your message and appreciate
|
||||
your interest!
|
||||
We maintain a [loose roadmap on our wiki](https://github.com/jorisroovers/gitlint/wiki/Roadmap), but
|
||||
We maintain a [loose project plan on github projects](https://github.com/users/jorisroovers/projects/1/), but
|
||||
that's open to a lot of change and input.
|
||||
|
||||
## Guidelines
|
||||
|
@ -19,11 +19,15 @@ When contributing code, please consider all the parts that are typically require
|
|||
- [Integration tests](https://github.com/jorisroovers/gitlint/tree/main/qa) (also automatically
|
||||
[enforced by CI](https://github.com/jorisroovers/gitlint/actions)). Again, please consider writing new ones
|
||||
for your functionality, not only updating existing ones to make the build pass.
|
||||
- [Documentation](https://github.com/jorisroovers/gitlint/tree/main/docs)
|
||||
- [Documentation](https://github.com/jorisroovers/gitlint/tree/main/docs).
|
||||
|
||||
Since we want to maintain a high standard of quality, all of these things will have to be done regardless before code
|
||||
can make it as part of a release. If you can already include them as part of your PR, it's a huge timesaver for us
|
||||
and it's likely that your PR will be merged and released a lot sooner. Thanks!
|
||||
can make it as part of a release. **Gitlint commits and pull requests are gated on all of our tests and checks as well as
|
||||
code-review**. If you can already include them as part of your PR, it's a huge timesaver for us
|
||||
and it's likely that your PR will be merged and released a lot sooner.
|
||||
|
||||
It's also a good idea to open an issue before submitting a PR for non-trivial changes, so we can discuss what you have
|
||||
in mind before you spend the effort. Thanks!
|
||||
|
||||
!!! Important
|
||||
**On the topic of releases**: Gitlint releases typically go out when there's either enough new features and fixes
|
||||
|
@ -32,55 +36,105 @@ and it's likely that your PR will be merged and released a lot sooner. Thanks!
|
|||
or months before merged code actually gets released - we know that can be frustrating but please understand it's
|
||||
a well-considered trade-off based on available time.
|
||||
|
||||
## Development
|
||||
## Local setup
|
||||
|
||||
There is a Vagrantfile (Ubuntu) in this repository that can be used for development.
|
||||
It comes pre-installed with all Python versions that gitlint supports.
|
||||
```sh
|
||||
vagrant up
|
||||
vagrant ssh
|
||||
```
|
||||
|
||||
Or you can choose to use your local environment:
|
||||
To install gitlint for local development:
|
||||
|
||||
```sh
|
||||
python -m venv .venv
|
||||
. .venv/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip install -r requirements.txt -r test-requirements.txt -r doc-requirements.txt
|
||||
python setup.py develop
|
||||
```
|
||||
|
||||
To run tests:
|
||||
## Github Devcontainer
|
||||
|
||||
We provide a devcontainer on github to make it easier to get started with gitlint development using VSCode.
|
||||
|
||||
To start one, click the plus button under the *Code* dropdown on
|
||||
[the gitlint repo on github](https://github.com/jorisroovers/gitlint).
|
||||
|
||||
**It can take ~15min for all post installation steps to finish.**
|
||||
|
||||

|
||||
|
||||
|
||||
After setup has finished, you should be able to just activate the virtualenv in the home dir and run the tests:
|
||||
```sh
|
||||
. ~/.venv/bin/activate
|
||||
./run_tests.sh
|
||||
```
|
||||
|
||||
By default we have python 3.11 installed in the dev container, but you can also use [asdf](https://asdf-vm.com/)
|
||||
(preinstalled) to install additional python versions:
|
||||
|
||||
```sh
|
||||
# Ensure ASDF overrides system python in PATH
|
||||
# You can also append this line to your ~/.bash_profile in the devcontainer to have this happen automatically on login
|
||||
source "$(brew --prefix asdf)/libexec/asdf.sh"
|
||||
|
||||
# Install python 3.9.15
|
||||
asdf install python 3.9.15
|
||||
# List all available python versions
|
||||
asdf list all python
|
||||
# List installed python versions
|
||||
asdf list python
|
||||
```
|
||||
|
||||
## Running tests
|
||||
```sh
|
||||
./run_tests.sh # run unit tests and print test coverage
|
||||
./run_tests.sh gitlint/tests/rules/test_body_rules.py::BodyRuleTests::test_body_missing # run a single test
|
||||
./run_tests.sh gitlint-core/gitlint/tests/rules/test_body_rules.py::BodyRuleTests::test_body_missing # run a single test
|
||||
pytest -k test_body_missing # Alternative way to run a specific test by invoking pytest directly with a keyword expression
|
||||
./run_tests.sh --no-coverage # run unit tests without test coverage
|
||||
./run_tests.sh --collect-only --no-coverage # Only collect, don't run unit tests
|
||||
./run_tests.sh --integration # Run integration tests (requires that you have gitlint installed)
|
||||
./run_tests.sh --build # Run build tests (=build python package)
|
||||
./run_tests.sh --pep8 # pep8 checks
|
||||
./run_tests.sh --format # format checks (black)
|
||||
./run_tests.sh --stats # print some code stats
|
||||
./run_tests.sh --git # inception: run gitlint against itself
|
||||
./run_tests.sh --lint # run pylint checks
|
||||
./run_tests.sh --all # Run unit, integration, pep8 and gitlint checks
|
||||
./run_tests.sh --all # Run unit, integration, format and gitlint checks
|
||||
```
|
||||
## Formatting
|
||||
|
||||
We use [black](https://black.readthedocs.io/en/stable/) for code formatting.
|
||||
To use it, just run black against the code you modified:
|
||||
|
||||
The `Vagrantfile` comes with `virtualenv`s for python 3.6, 3.7, 3.8, 3.9 and pypy3.6.
|
||||
You can easily run tests against specific python environments by using the following commands *inside* of the Vagrant VM:
|
||||
```sh
|
||||
./run_tests.sh --envs 36 # Run the unit tests against Python 3.6
|
||||
./run_tests.sh --envs 36,37,pypy36 # Run the unit tests against Python 3.6, Python 3.7 and Pypy3.6
|
||||
./run_tests.sh --envs 36,37 --pep8 # Run pep8 checks against Python 3.6 and Python 3.7 (also works for --git, --integration, --pep8, --stats and --lint.
|
||||
./run_tests.sh --envs all --all # Run all tests against all environments
|
||||
./run_tests.sh --all-env --all # Idem: Run all tests against all environments
|
||||
black . # format all python code
|
||||
black gitlint-core/gitlint/lint.py # format a specific file
|
||||
```
|
||||
|
||||
!!! important
|
||||
Gitlint commits and pull requests are gated on all of our tests and checks.
|
||||
## Documentation
|
||||
We use [mkdocs](https://www.mkdocs.org/) for generating our documentation from markdown.
|
||||
|
||||
To use it:
|
||||
```sh
|
||||
pip install -r doc-requirements.txt # install doc requirements
|
||||
mkdocs serve
|
||||
```
|
||||
|
||||
Then access the documentation website on [http://localhost:8000]().
|
||||
|
||||
## Packaging
|
||||
|
||||
Gitlint consists of 2 python packages: [gitlint](https://pypi.org/project/gitlint/)
|
||||
and [gitlint-core](https://pypi.org/project/gitlint-core/).
|
||||
|
||||
The `gitlint` package is just a wrapper package around `gitlint-core[trusted-deps]` which strictly pins gitlint
|
||||
dependencies to known working versions.
|
||||
|
||||
There are scenarios where users (or OS package managers) may want looser dependency requirements.
|
||||
In these cases, users can just install `gitlint-core` directly (`pip install gitlint-core`).
|
||||
|
||||
[Issue 162](https://github.com/jorisroovers/gitlint/issues/162) has all the background of how we got to the decision
|
||||
to split gitlint in 2 packages.
|
||||
|
||||

|
||||
|
||||
### Packaging description
|
||||
|
||||
To see the package description in HTML format
|
||||
```sh
|
||||
pip install docutils
|
||||
|
@ -89,16 +143,6 @@ export LANG=en_US.UTF-8
|
|||
python setup.py --long-description | rst2html.py > output.html
|
||||
```
|
||||
|
||||
## Documentation
|
||||
We use [mkdocs](https://www.mkdocs.org/) for generating our documentation from markdown.
|
||||
|
||||
To use it, do the following outside of the vagrant box (on your host machine):
|
||||
```sh
|
||||
pip install -r doc-requirements.txt # install doc requirements
|
||||
mkdocs serve
|
||||
```
|
||||
|
||||
Then access the documentation website on your host machine on [http://localhost:8000]().
|
||||
|
||||
## Tools
|
||||
We keep a small set of scripts in the `tools/` directory:
|
||||
|
@ -110,13 +154,13 @@ tools/windows/run_tests.bat # Windows run unit tests
|
|||
```
|
||||
|
||||
## Contrib rules
|
||||
Since gitlint 0.12.0, we support [Contrib rules](../contrib_rules): community contributed rules that are part of gitlint
|
||||
Since gitlint 0.12.0, we support [Contrib rules](contrib_rules.md): community contributed rules that are part of gitlint
|
||||
itself. Thanks for considering to add a new one to gitlint!
|
||||
|
||||
Before starting, please read all the other documentation on this page about contributing first.
|
||||
Then, we suggest taking the following approach to add a Contrib rule:
|
||||
|
||||
1. **Write your rule as a [user-defined rule](../user_defined_rules)**. In terms of code, Contrib rules are identical to
|
||||
1. **Write your rule as a [user-defined rule](user_defined_rules.md)**. In terms of code, Contrib rules are identical to
|
||||
user-defined rules, they just happen to have their code sit within the gitlint codebase itself.
|
||||
2. **Add your user-defined rule to gitlint**. You should put your file(s) in the [gitlint/contrib/rules](https://github.com/jorisroovers/gitlint/tree/main/gitlint-core/gitlint/contrib/rules) directory.
|
||||
3. **Write unit tests**. The gitlint codebase contains [Contrib rule test files you can copy and modify](https://github.com/jorisroovers/gitlint/tree/main/gitlint-core/gitlint/tests/contrib/rules).
|
||||
|
@ -129,7 +173,7 @@ If you follow the steps above and follow the existing gitlint conventions wrt na
|
|||
|
||||
In case you're looking for a slightly more formal spec, here's what gitlint requires of Contrib rules.
|
||||
|
||||
- Since Contrib rules are really just user-defined rules that live within the gitlint code-base, all the [user-rule requirements](../user_defined_rules/#rule-requirements) also apply to Contrib rules.
|
||||
- Since Contrib rules are really just user-defined rules that live within the gitlint code-base, all the [user-rule requirements](user_defined_rules.md#rule-requirements) also apply to Contrib rules.
|
||||
- All contrib rules **must** have associated unit tests. We *sort of* enforce this by a unit test that verifies that there's a
|
||||
test file for each contrib file.
|
||||
- All contrib rules **must** have names that start with `contrib-`. This is to easily distinguish them from default gitlint rules.
|
||||
|
@ -137,4 +181,4 @@ In case you're looking for a slightly more formal spec, here's what gitlint requ
|
|||
- All contrib rules **must** have unique names and ids.
|
||||
- You **can** add multiple rule classes to the same file, but classes **should** be logically grouped together in a single file that implements related rules.
|
||||
- Contrib rules **should** be meaningfully different from one another. If a behavior change or tweak can be added to an existing rule by adding options, that should be considered first. However, large [god classes](https://en.wikipedia.org/wiki/God_object) that implement multiple rules in a single class should obviously also be avoided.
|
||||
- Contrib rules **should** use [options](../user_defined_rules/#options) to make rules configurable.
|
||||
- Contrib rules **should** use [options](user_defined_rules.md#options) to make rules configurable.
|
||||
|
|
|
@ -1448,7 +1448,7 @@
|
|||
],
|
||||
[
|
||||
0.002767,
|
||||
"\u001b[1;1H\u001b[93m 1 \r\n 2 \u001b[m\u001b[96m# Please enter the commit message for your changes. Lines starting\u001b[m\r\n\u001b[93m 3 \u001b[m\u001b[96m# with '#' will be ignored, and an empty message aborts the commit.\u001b[m\r\n\u001b[93m 4 \u001b[m\u001b[96m# On branch \u001b[m\u001b[38;5;224mmaster\u001b[m\r\n\u001b[93m 5 \u001b[m\u001b[96m# \u001b[m\u001b[38;5;81mChanges to be committed:\u001b[m\r\n\u001b[93m 6 \u001b[m\u001b[96m# \u001b[m\u001b[38;5;121mnew file\u001b[m\u001b[96m: \u001b[m\u001b[95m foo.txt\u001b[m\r\n\u001b[93m 7 \u001b[m\u001b[96m#\u001b[m\r\n\u001b[94m~ \u001b[9;1H~ \u001b[10;1H~ \u001b[11;1H~ \u001b[12;1H~ \u001b[13;1H~ "
|
||||
"\u001b[1;1H\u001b[93m 1 \r\n 2 \u001b[m\u001b[96m# Please enter the commit message for your changes. Lines starting\u001b[m\r\n\u001b[93m 3 \u001b[m\u001b[96m# with '#' will be ignored, and an empty message aborts the commit.\u001b[m\r\n\u001b[93m 4 \u001b[m\u001b[96m# On branch \u001b[m\u001b[38;5;224mmain\u001b[m\r\n\u001b[93m 5 \u001b[m\u001b[96m# \u001b[m\u001b[38;5;81mChanges to be committed:\u001b[m\r\n\u001b[93m 6 \u001b[m\u001b[96m# \u001b[m\u001b[38;5;121mnew file\u001b[m\u001b[96m: \u001b[m\u001b[95m foo.txt\u001b[m\r\n\u001b[93m 7 \u001b[m\u001b[96m#\u001b[m\r\n\u001b[94m~ \u001b[9;1H~ \u001b[10;1H~ \u001b[11;1H~ \u001b[12;1H~ \u001b[13;1H~ "
|
||||
],
|
||||
[
|
||||
0.000062,
|
||||
|
@ -2404,7 +2404,7 @@
|
|||
],
|
||||
[
|
||||
0.052844,
|
||||
"1: T3 Title has trailing punctuation (!): \"WIP: This is an patchset that I need to continue working on!\"\r\n1: T5 Title contains the word 'WIP' (case-insensitive): \"WIP: This is an patchset that I need to continue working on!\"\r\n3: B6 Body message is missing\r\n"
|
||||
"1: T3 Title has trailing punctuation (!): \"WIP: This is a patchset that I need to continue working on!\"\r\n1: T5 Title contains the word 'WIP' (case-insensitive): \"WIP: This is a patchset that I need to continue working on!\"\r\n3: B6 Body message is missing\r\n"
|
||||
],
|
||||
[
|
||||
0.006075,
|
||||
|
@ -2432,7 +2432,7 @@
|
|||
],
|
||||
[
|
||||
0.004763,
|
||||
"[master 4b1f92d] WIP: This is an patchset that I need to continue working on!\r\n"
|
||||
"[main 4b1f92d] WIP: This is a patchset that I need to continue working on!\r\n"
|
||||
],
|
||||
[
|
||||
0.001504,
|
||||
|
@ -3108,11 +3108,11 @@
|
|||
],
|
||||
[
|
||||
0.050694,
|
||||
"1: T1 Title exceeds max length (60\u003e50): \"WIP: This is an patchset that I need to continue working on!\"\r\n"
|
||||
"1: T1 Title exceeds max length (60\u003e50): \"WIP: This is a patchset that I need to continue working on!\"\r\n"
|
||||
],
|
||||
[
|
||||
0.000006,
|
||||
"1: T3 Title has trailing punctuation (!): \"WIP: This is an patchset that I need to continue working on!\"\r\n1: T5 Title contains the word 'WIP' (case-insensitive): \"WIP: This is an patchset that I need to continue working on!\"\r\n3: B6 Body message is missing\r\n"
|
||||
"1: T3 Title has trailing punctuation (!): \"WIP: This is a patchset that I need to continue working on!\"\r\n1: T5 Title contains the word 'WIP' (case-insensitive): \"WIP: This is a patchset that I need to continue working on!\"\r\n3: B6 Body message is missing\r\n"
|
||||
],
|
||||
[
|
||||
0.005418,
|
||||
|
@ -3508,7 +3508,7 @@
|
|||
],
|
||||
[
|
||||
0.050989,
|
||||
"1: T1 Title exceeds max length (60\u003e50): \"WIP: This is an patchset that I need to continue working on!\"\r\n1: T5 Title contains the word 'WIP' (case-insensitive): \"WIP: This is an patchset that I need to continue working on!\"\r\n"
|
||||
"1: T1 Title exceeds max length (60\u003e50): \"WIP: This is a patchset that I need to continue working on!\"\r\n1: T5 Title contains the word 'WIP' (case-insensitive): \"WIP: This is a patchset that I need to continue working on!\"\r\n"
|
||||
],
|
||||
[
|
||||
0.000025,
|
||||
|
@ -3795,4 +3795,4 @@
|
|||
"exit\r\n"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
|
@ -2,3 +2,11 @@ a.toctree-l3 {
|
|||
margin-left: 10px;
|
||||
/* display: none; */
|
||||
}
|
||||
|
||||
.wy-nav-content {
|
||||
max-width: 1000px;
|
||||
}
|
||||
|
||||
.document hr {
|
||||
border-top: 1px solid #666;
|
||||
}
|
BIN
docs/images/dev-container.png
Normal file
BIN
docs/images/dev-container.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 207 KiB |
351
docs/images/gitlint-packages.drawio.svg
Normal file
351
docs/images/gitlint-packages.drawio.svg
Normal file
|
@ -0,0 +1,351 @@
|
|||
<svg host="65bd71144e" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="491px" height="391px" viewBox="-0.5 -0.5 491 391" content="<mxfile><diagram id="x7jBp0SZ1TbX-vMHKkT6" name="Page-1">7Vtbb+o4EP41SGcfQEmccHks0O4e6axUbbW3p5VLDFg1MccxBc6vX9+SkNiUAEkvu62q4owvib/5ZjwzoR0wWe1+ZnC9/JXGiHQCL951wLQTBFHoi79SsNeCsB9owYLhWIv8QvCAfyAj9Ix0g2OUlgZySgnH67JwRpMEzXhJBhmj2/KwOSXlu67hAlmChxkktvRPHPOllg6DQSH/BeHFMruz3x/pnhXMBpudpEsY0+2BCNx2wIRRynVrtZsgIrHLcNHz7o705g/GUMLrTAB6wjMkG7O3TtAnYur4UTQWsrHAnOCEd2eUoaxTLJj3m43wfYbOdok5eljDmbzeCgKIQUu+IuLKF01I8CIRbaYBGj8jxrHA9sbIOZUTUjEfJ4vfDIogv5EcjnZHt+vnIAryIbpCnO3FEDMhZ5AhHsj0sC3UGAyNbHmgwiAyQmios8jXLtAVDQOwG+zQAfZl2BE05wVI39TVtN8QRiAqYzSwMfI9B0a58BqMoqOExAXhtGBOxYakkRPK1ND+9w3VA8B87nnycQqRnsvZJuUo7sZIuIqCzHqp8vJCjC/luJvTDSgHDN5SOYPT3gLtOIP/MPR9gxlKa/kLgQZ303wmUEHMgecKx7GcPhb3wD/go1rKE9drKlyV2mE07kRTudaG01SfIHLplDP6hCaGMwlN5CpzTEhF1IiuKs4mqqmroAFVDU+rCicph4R8KkthHozeTlkjS1kPdMOEbwm8iYidOsFEtr59FX/FdtRjK+x0B+Kzc/1TI8dEmd3hyHGUhpENWL8BwLJj3EHvGD9n5J0QPHuSvWA67Hk9kFsAq/p6cZAmmUwFiHqW3wt6vj2r1+sd2Mrh3APxwXOcYUTmYP+QJgSGFUZ4NiNGDgtqIrTy/fqECPpwJe1B60Zw4xxeVCd/0qO2wwhP02PQFj3sPOd+f/9VPf/sSWZ7ZzpQRjdJjOLm3KlfMR7g1zOeJo4fv386WDBZ4H8tAfRHvn1quRLAUdQAzsFHY6E/tOFpjYV2FHQps14zPRYBjc0gV6AYNsCg4Hjc8xnW1wnrA8/WVmthvW8nYaViWpQHBG9a25Aqkr9ezx/0vGPUeIWMIgRlXQHQi2xtjRw5BWhCW6G1dRQv0IO5pIwv6YImkNwWUhsBOeXl/Qceh2yBsujGDQlDBHL8XF7KtTsz9V6ng3koHpX9uJV0pSq/NLMKjG4Yg/uDYcaUz77PXc3xYbk8LRr6CQqF5ZjU848jS4cHGpKWcAdXmMi7/4FYDBNoxJPc0MDdnTIvMFap9l/GqamLv5WVRNnldHfYOd2bq8uIAAatMCF3bpmGwmEtJtgLDU4spDdjLXSJFl3JXEWt6RKuZRPOuFTcKfdUjpSOabwBJ1Y1iCB0+LDQFR4MGggP7ADzowIXOvKf1mA7/tJBZ+8H+GWHrkSiOzfO5EY9FHlGMkBScHiqX8c8stcP1ruDjq3ZgewKDYIeQVxEWl0TterOhLIVJLpfHsRdE5bJvjwyy/qw0FRiVvWy+6kezmCSzsVa2aomvvK2lMXlO+YTY5yuCTS7w4kIW8ycOaGQVxaqxiJWYLPGa7WMik1Fy84nrRjIKp5cFJg44sr6oW2F755n+E7gIyJjkbQtlH2UTEL+NBQQVXzJ0DYJZ+zaRDT0wguET5to1yaqb9rbMowj3K5vHa9jBX453w5dbzxBS1YAjpeV350VvCOm/54iBQ3DMxlBioQUyYebYVmN8L6saCrFmxSx9KdmSW2R1+H+r+HzMaO5hud5rc1B7H5bxHZFip/ErkdsQqn6LPO6+hroC5Qk34v0SnwwnD41TPV377+zNxn91+Q1sNC8vADQqZnIt560h0Ul7Ny0PbCXKi/UXNoO+hb2ZxXQ8npL1+t5Xl5l0UUXH5youqire8SweGJJeyWsp/CKFz+3chO2woHqm6qwah4NlfCqWUZ2n6OEqowHQ1DhzXUlPFDjW5JiBl6n6NzqRc3z/WzCXJnkVUuirqp34PCXTbyiAC8WTC+tgLZmdprznYOCadkU9TvEK2yxNm6ur0L+j1gqzL4tjorL4vvv2oEU/0QAbv8F</diagram></mxfile>">
|
||||
<defs/>
|
||||
<g>
|
||||
<rect x="210" y="140" width="280" height="250" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
|
||||
<g transform="translate(-0.5 -0.5)">
|
||||
<switch>
|
||||
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe flex-end; width: 275px; height: 1px; padding-top: 147px; margin-left: 210px;">
|
||||
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: right;">
|
||||
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
|
||||
<b>
|
||||
gitlint-core
|
||||
</b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</foreignObject>
|
||||
<text x="485" y="159" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="end">
|
||||
gitlint-core
|
||||
</text>
|
||||
</switch>
|
||||
</g>
|
||||
<rect x="235" y="190" width="100" height="100" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
|
||||
<rect x="375" y="190" width="100" height="100" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
|
||||
<g transform="translate(-0.5 -0.5)">
|
||||
<switch>
|
||||
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe center; width: 98px; height: 1px; padding-top: 197px; margin-left: 376px;">
|
||||
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
|
||||
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
|
||||
<i>
|
||||
<font color="#ff0000">
|
||||
trusted-deps
|
||||
</font>
|
||||
</i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</foreignObject>
|
||||
<text x="425" y="209" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
|
||||
trusted-deps
|
||||
</text>
|
||||
</switch>
|
||||
</g>
|
||||
<rect x="370" y="170" width="100" height="20" fill="none" stroke="none" pointer-events="all"/>
|
||||
<g transform="translate(-0.5 -0.5)">
|
||||
<switch>
|
||||
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 180px; margin-left: 420px;">
|
||||
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
|
||||
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: nowrap;">
|
||||
<b>
|
||||
extra_requires
|
||||
</b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</foreignObject>
|
||||
<text x="420" y="184" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
|
||||
extra_requires
|
||||
</text>
|
||||
</switch>
|
||||
</g>
|
||||
<rect x="229" y="170" width="100" height="20" fill="none" stroke="none" pointer-events="all"/>
|
||||
<g transform="translate(-0.5 -0.5)">
|
||||
<switch>
|
||||
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 180px; margin-left: 279px;">
|
||||
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
|
||||
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: nowrap;">
|
||||
<b>
|
||||
install_requires
|
||||
</b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</foreignObject>
|
||||
<text x="279" y="184" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
|
||||
install_requires
|
||||
</text>
|
||||
</switch>
|
||||
</g>
|
||||
<rect x="230" y="310" width="245" height="60" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
|
||||
<g transform="translate(-0.5 -0.5)">
|
||||
<switch>
|
||||
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 243px; height: 1px; padding-top: 340px; margin-left: 231px;">
|
||||
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
|
||||
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
|
||||
Source Code, CLI entry point, etc
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</foreignObject>
|
||||
<text x="353" y="344" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
|
||||
Source Code, CLI entry point, etc
|
||||
</text>
|
||||
</switch>
|
||||
</g>
|
||||
<rect x="380" y="220" width="90" height="50" fill="none" stroke="none" pointer-events="all"/>
|
||||
<g transform="translate(-0.5 -0.5)">
|
||||
<switch>
|
||||
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe flex-start; width: 1px; height: 1px; padding-top: 245px; margin-left: 382px;">
|
||||
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: left;">
|
||||
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: nowrap;">
|
||||
<div>
|
||||
Click==8.0.3
|
||||
<br/>
|
||||
<span>
|
||||
arrow==1.2.1
|
||||
<br/>
|
||||
...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</foreignObject>
|
||||
<text x="382" y="249" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px">
|
||||
Click==8.0.3...
|
||||
</text>
|
||||
</switch>
|
||||
</g>
|
||||
<rect x="240" y="220" width="70" height="50" fill="none" stroke="none" pointer-events="all"/>
|
||||
<g transform="translate(-0.5 -0.5)">
|
||||
<switch>
|
||||
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe flex-start; width: 1px; height: 1px; padding-top: 245px; margin-left: 242px;">
|
||||
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: left;">
|
||||
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: nowrap;">
|
||||
<div>
|
||||
Click>=8
|
||||
<br/>
|
||||
<span>
|
||||
arrow>=1
|
||||
<br/>
|
||||
...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</foreignObject>
|
||||
<text x="242" y="249" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px">
|
||||
Click>=8...
|
||||
</text>
|
||||
</switch>
|
||||
</g>
|
||||
<rect x="180" y="130" width="90" height="20" rx="3" ry="3" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
|
||||
<g transform="translate(-0.5 -0.5)">
|
||||
<switch>
|
||||
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 88px; height: 1px; padding-top: 140px; margin-left: 181px;">
|
||||
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
|
||||
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
|
||||
PyPI package
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</foreignObject>
|
||||
<text x="225" y="144" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
|
||||
PyPI package
|
||||
</text>
|
||||
</switch>
|
||||
</g>
|
||||
<rect x="210" y="11" width="280" height="95" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
|
||||
<g transform="translate(-0.5 -0.5)">
|
||||
<switch>
|
||||
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe flex-end; width: 275px; height: 1px; padding-top: 18px; margin-left: 210px;">
|
||||
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: right;">
|
||||
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
|
||||
<b>
|
||||
gitlint
|
||||
</b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</foreignObject>
|
||||
<text x="485" y="30" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="end">
|
||||
gitlint
|
||||
</text>
|
||||
</switch>
|
||||
</g>
|
||||
<rect x="180" y="1" width="90" height="20" rx="3" ry="3" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
|
||||
<g transform="translate(-0.5 -0.5)">
|
||||
<switch>
|
||||
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 88px; height: 1px; padding-top: 11px; margin-left: 181px;">
|
||||
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
|
||||
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
|
||||
PyPI package
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</foreignObject>
|
||||
<text x="225" y="15" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
|
||||
PyPI package
|
||||
</text>
|
||||
</switch>
|
||||
</g>
|
||||
<rect x="235" y="46" width="200" height="45" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
|
||||
<rect x="229" y="26" width="100" height="20" fill="none" stroke="none" pointer-events="all"/>
|
||||
<g transform="translate(-0.5 -0.5)">
|
||||
<switch>
|
||||
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 36px; margin-left: 279px;">
|
||||
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: center;">
|
||||
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: nowrap;">
|
||||
<b>
|
||||
install_requires
|
||||
</b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</foreignObject>
|
||||
<text x="279" y="40" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px" text-anchor="middle">
|
||||
install_requires
|
||||
</text>
|
||||
</switch>
|
||||
</g>
|
||||
<rect x="243" y="53.5" width="195" height="30" fill="none" stroke="none" pointer-events="all"/>
|
||||
<g transform="translate(-0.5 -0.5)">
|
||||
<switch>
|
||||
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe flex-start; justify-content: unsafe flex-start; width: 193px; height: 1px; padding-top: 61px; margin-left: 245px;">
|
||||
<div data-drawio-colors="color: rgb(0, 0, 0); " style="box-sizing: border-box; font-size: 0px; text-align: left;">
|
||||
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">
|
||||
gitlint-core[
|
||||
<i>
|
||||
<font color="#ff0000">
|
||||
trusted-deps
|
||||
</font>
|
||||
</i>
|
||||
]==0.17.0
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</foreignObject>
|
||||
<text x="245" y="73" fill="rgb(0, 0, 0)" font-family="Helvetica" font-size="12px">
|
||||
gitlint-core[trusted-deps]==0.17...
|
||||
</text>
|
||||
</switch>
|
||||
</g>
|
||||
<path d="M 350 80 L 350 230 Q 350 240 359.32 240 L 368.63 240" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
|
||||
<path d="M 373.88 240 L 366.88 243.5 L 368.63 240 L 366.88 236.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
|
||||
<path d="M 100 68 L 193.63 68" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
|
||||
<path d="M 198.88 68 L 191.88 71.5 L 193.63 68 L 191.88 64.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
|
||||
<path d="M 50 91.5 C 50 72.7 50 63.3 70 63.3 C 56.67 63.3 56.67 44.5 70 44.5 C 83.33 44.5 83.33 63.3 70 63.3 C 90 63.3 90 72.7 90 91.5 Z" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
|
||||
<path d="M 50 277 C 50 258.2 50 248.8 70 248.8 C 56.67 248.8 56.67 230 70 230 C 83.33 230 83.33 248.8 70 248.8 C 90 248.8 90 258.2 90 277 Z" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
|
||||
<rect x="20" y="100" width="100" height="30" fill="none" stroke="none" pointer-events="all"/>
|
||||
<g transform="translate(-0.5 -0.5)">
|
||||
<switch>
|
||||
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 98px; height: 1px; padding-top: 115px; margin-left: 21px;">
|
||||
<div data-drawio-colors="color: #000000; background-color: #FFFFFF; " style="box-sizing: border-box; font-size: 0px; text-align: center;">
|
||||
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: normal; overflow-wrap: normal;">
|
||||
<span style="font-family: "helvetica" ; font-size: 12px ; font-weight: 400 ; letter-spacing: normal ; text-align: center ; text-indent: 0px ; text-transform: none ; word-spacing: 0px ; display: inline ; float: none">
|
||||
<i>
|
||||
pip install gitlint
|
||||
</i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</foreignObject>
|
||||
<text x="70" y="119" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
|
||||
pip install gitl...
|
||||
</text>
|
||||
</switch>
|
||||
</g>
|
||||
<rect x="15" y="290" width="130" height="30" fill="none" stroke="none" pointer-events="all"/>
|
||||
<g transform="translate(-0.5 -0.5)">
|
||||
<switch>
|
||||
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 128px; height: 1px; padding-top: 305px; margin-left: 16px;">
|
||||
<div data-drawio-colors="color: #000000; background-color: #FFFFFF; " style="box-sizing: border-box; font-size: 0px; text-align: center;">
|
||||
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: normal; overflow-wrap: normal;">
|
||||
<span style="font-family: "helvetica" ; font-size: 12px ; font-weight: 400 ; letter-spacing: normal ; text-align: center ; text-indent: 0px ; text-transform: none ; word-spacing: 0px ; display: inline ; float: none">
|
||||
<i>
|
||||
pip install gitlint-core
|
||||
</i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</foreignObject>
|
||||
<text x="80" y="309" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
|
||||
pip install gitlint-c...
|
||||
</text>
|
||||
</switch>
|
||||
</g>
|
||||
<rect x="0" y="0" width="160" height="30" fill="none" stroke="none" pointer-events="all"/>
|
||||
<g transform="translate(-0.5 -0.5)">
|
||||
<switch>
|
||||
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 158px; height: 1px; padding-top: 15px; margin-left: 1px;">
|
||||
<div data-drawio-colors="color: #000000; background-color: #FFFFFF; " style="box-sizing: border-box; font-size: 0px; text-align: center;">
|
||||
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: normal; overflow-wrap: normal;">
|
||||
<span style="font-family: "helvetica" ; font-size: 12px ; font-weight: 400 ; letter-spacing: normal ; text-indent: 0px ; text-transform: none ; word-spacing: 0px ; display: inline ; float: none">
|
||||
Use strict dependencies (most users)
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</foreignObject>
|
||||
<text x="80" y="19" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
|
||||
Use strict dependencies (m...
|
||||
</text>
|
||||
</switch>
|
||||
</g>
|
||||
<rect x="0" y="180" width="160" height="30" fill="none" stroke="none" pointer-events="all"/>
|
||||
<g transform="translate(-0.5 -0.5)">
|
||||
<switch>
|
||||
<foreignObject pointer-events="none" width="100%" height="100%" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility" style="overflow: visible; text-align: left;">
|
||||
<div xmlns="http://www.w3.org/1999/xhtml" style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 158px; height: 1px; padding-top: 195px; margin-left: 1px;">
|
||||
<div data-drawio-colors="color: #000000; background-color: #FFFFFF; " style="box-sizing: border-box; font-size: 0px; text-align: center;">
|
||||
<div style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: normal; overflow-wrap: normal;">
|
||||
<span style="font-family: "helvetica" ; font-size: 12px ; font-weight: 400 ; letter-spacing: normal ; text-indent: 0px ; text-transform: none ; word-spacing: 0px ; display: inline ; float: none">
|
||||
Use loose dependencies
|
||||
<br/>
|
||||
(at your risk)
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</foreignObject>
|
||||
<text x="80" y="199" fill="#000000" font-family="Helvetica" font-size="12px" text-anchor="middle">
|
||||
Use loose dependencies...
|
||||
</text>
|
||||
</switch>
|
||||
</g>
|
||||
<path d="M 100 253.5 L 193.63 253.03" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
|
||||
<path d="M 198.88 253.01 L 191.9 256.54 L 193.63 253.03 L 191.86 249.54 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
|
||||
<path d="M 210 250 L 215 250 Q 220 250 220 240 L 220 213 Q 220 203 224.07 203 L 228.13 203" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
|
||||
<path d="M 233.38 203 L 226.38 206.5 L 228.13 203 L 226.38 199.5 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
|
||||
<ellipse cx="210" cy="253.5" rx="10" ry="10" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
|
||||
<path d="M 220 68 L 228.64 68.29" fill="none" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="stroke"/>
|
||||
<path d="M 233.88 68.46 L 226.77 71.73 L 228.64 68.29 L 227 64.73 Z" fill="rgb(0, 0, 0)" stroke="rgb(0, 0, 0)" stroke-miterlimit="10" pointer-events="all"/>
|
||||
<ellipse cx="210" cy="68" rx="10" ry="10" fill="rgb(255, 255, 255)" stroke="rgb(0, 0, 0)" pointer-events="all"/>
|
||||
</g>
|
||||
<switch>
|
||||
<g requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"/>
|
||||
<a transform="translate(0,-5)" xlink:href="https://www.diagrams.net/doc/faq/svg-export-text-problems" target="_blank">
|
||||
<text text-anchor="middle" font-size="10px" x="50%" y="100%">
|
||||
Viewer does not support full SVG 1.1
|
||||
</text>
|
||||
</a>
|
||||
</switch>
|
||||
</svg>
|
After Width: | Height: | Size: 29 KiB |
BIN
docs/images/gitlint-packages.png
Normal file
BIN
docs/images/gitlint-packages.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
118
docs/index.md
118
docs/index.md
|
@ -22,11 +22,11 @@ Great for use as a [commit-msg git hook](#using-gitlint-as-a-commit-msg-hook) or
|
|||
- **Easily integrated**: Gitlint is designed to work [with your own scripts or CI system](#using-gitlint-in-a-ci-environment).
|
||||
- **Sane defaults:** Many of gitlint's validations are based on
|
||||
[well-known](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html),
|
||||
[community](http://addamhardy.com/2013/06/05/good-commit-messages-and-enforcing-them-with-git-hooks.html),
|
||||
[community](https://addamhardy.com/2013-06-05-good-commit-messages-and-enforcing-them-with-git-hooks),
|
||||
[standards](http://chris.beams.io/posts/git-commit/), others are based on checks that we've found
|
||||
useful throughout the years.
|
||||
- **Easily configurable:** Gitlint has sane defaults, but [you can also easily customize it to your own liking](configuration.md).
|
||||
- **Community contributed rules**: Conventions that are common but not universal [can be selectively enabled](contrib_rules).
|
||||
- **Community contributed rules**: Conventions that are common but not universal [can be selectively enabled](contrib_rules.md).
|
||||
- **User-defined rules:** Want to do more then what gitlint offers out of the box? Write your own [user defined rules](user_defined_rules.md).
|
||||
- **Full unicode support:** Lint your Russian, Chinese or Emoji commit messages with ease!
|
||||
- **Production-ready:** Gitlint checks a lot of the boxes you're looking for: actively maintained, high unit test coverage, integration tests,
|
||||
|
@ -38,6 +38,10 @@ useful throughout the years.
|
|||
# Pip is recommended to install the latest version
|
||||
pip install gitlint
|
||||
|
||||
# Alternative: by default, gitlint is installed with pinned dependencies.
|
||||
# To install gitlint with looser dependency requirements, only install gitlint-core.
|
||||
pip install gitlint-core
|
||||
|
||||
# Community maintained packages:
|
||||
brew install gitlint # Homebrew (macOS)
|
||||
sudo port install gitlint # Macports (macOS)
|
||||
|
@ -81,6 +85,19 @@ $ cat examples/commit-message-2 | gitlint
|
|||
!!! note
|
||||
The returned exit code equals the number of errors found. [Some exit codes are special](index.md#exit-codes).
|
||||
|
||||
### Shell completion
|
||||
|
||||
```sh
|
||||
# Bash: add to ~/.bashrc
|
||||
eval "$(_GITLINT_COMPLETE=bash_source gitlint)"
|
||||
|
||||
# Zsh: add to ~/.zshrc
|
||||
eval "$(_GITLINT_COMPLETE=zsh_source gitlint)"
|
||||
|
||||
# Fish: add to ~/.config/fish/completions/foo-bar.fish
|
||||
eval (env _GITLINT_COMPLETE=fish_source gitlint)
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
For in-depth documentation of general and rule-specific configuration options, have a look at the [Configuration](configuration.md) and [Rules](rules.md) pages.
|
||||
|
@ -93,7 +110,7 @@ Short example `.gitlint` file ([full reference](configuration.md)):
|
|||
# their id or by their full name
|
||||
ignore=body-is-missing,T3
|
||||
|
||||
# Ignore any data send to gitlint via stdin
|
||||
# Ignore any data sent to gitlint via stdin
|
||||
ignore-stdin=true
|
||||
|
||||
# Configure title-max-length rule, set title length to 80 (72 = default)
|
||||
|
@ -136,7 +153,8 @@ Options:
|
|||
(e.g.: -c T1.line-length=80). Flag can be
|
||||
used multiple times to set multiple config values.
|
||||
--commit TEXT Hash (SHA) of specific commit to lint.
|
||||
--commits TEXT The range of commits to lint. [default: HEAD]
|
||||
--commits TEXT The range of commits (refspec or comma-separated
|
||||
hashes) to lint. [default: HEAD]
|
||||
-e, --extra-path PATH Path to a directory or python module with extra
|
||||
user-defined rules
|
||||
--ignore TEXT Ignore rules (comma-separated by id or name).
|
||||
|
@ -145,8 +163,9 @@ Options:
|
|||
--msg-filename FILENAME Path to a file containing a commit-msg.
|
||||
--ignore-stdin Ignore any stdin data. Useful for running in CI
|
||||
server.
|
||||
--staged Read staged commit meta-info from the local
|
||||
repository.
|
||||
--staged Attempt smart guesses about meta info (like
|
||||
author name, email, branch, changed files, etc)
|
||||
for staged commits.
|
||||
--fail-without-commits Hard fail when the target commit range is empty.
|
||||
-v, --verbose Verbosity, more v's for more verbose output
|
||||
(e.g.: -v, -vv, -vvv). [default: -vvv]
|
||||
|
@ -218,7 +237,7 @@ In case you want to change gitlint's behavior, you should either use a `.gitlint
|
|||
your `.pre-commit-config.yaml` file like so:
|
||||
```yaml
|
||||
- repo: https://github.com/jorisroovers/gitlint
|
||||
rev: # Fill in a tag / sha here
|
||||
rev: # Fill in a tag / sha here (e.g. v0.18.0)
|
||||
hooks:
|
||||
- id: gitlint
|
||||
args: [--contrib=CT1, --msg-filename]
|
||||
|
@ -229,6 +248,36 @@ your `.pre-commit-config.yaml` file like so:
|
|||
You need to add `--msg-filename` at the end of your custom `args` list as the gitlint-hook will fail otherwise.
|
||||
|
||||
|
||||
### gitlint and pre-commit in CI
|
||||
gitlint also supports a `gitlint-ci` pre-commit hook that can be used in CI environments.
|
||||
|
||||
Configure it like so:
|
||||
```yaml
|
||||
- repo: https://github.com/jorisroovers/gitlint
|
||||
rev: # insert ref, e.g. v0.18.0
|
||||
hooks:
|
||||
- id: gitlint # this is the regular commit-msg hook
|
||||
- id: gitlint-ci # hook for CI environments
|
||||
```
|
||||
|
||||
And invoke it in your CI environment like this:
|
||||
|
||||
```sh
|
||||
pre-commit run --hook-stage manual gitlint-ci
|
||||
```
|
||||
|
||||
By default this will only lint the latest commit.
|
||||
If you want to lint more commits you can modify the `gitlint-ci` hook like so:
|
||||
|
||||
```yaml
|
||||
- repo: https://github.com/jorisroovers/gitlint
|
||||
rev: v0.17.0
|
||||
hooks:
|
||||
- id: gitlint
|
||||
- id: gitlint-ci
|
||||
args: [--debug, --commits, mybranch] # enable debug mode, lint all commits in mybranch
|
||||
```
|
||||
|
||||
## Using gitlint in a CI environment
|
||||
By default, when just running `gitlint` without additional parameters, gitlint lints the last commit in the current
|
||||
working directory.
|
||||
|
@ -248,33 +297,48 @@ git log -1 --pretty=%B 62c0519 | gitlint
|
|||
Note that gitlint requires that you specify `--pretty=%B` (=only print the log message, not the metadata),
|
||||
future versions of gitlint might fix this and not require the `--pretty` argument.
|
||||
|
||||
## Linting specific commits
|
||||
## Linting specific commits or branches
|
||||
|
||||
Gitlint allows users to lint a specific commit:
|
||||
Gitlint can lint specific commits using `--commit`:
|
||||
```sh
|
||||
gitlint --commit 019cf40580a471a3958d3c346aa8bfd265fe5e16
|
||||
gitlint --commit 019cf40 # short SHAs work too
|
||||
gitlint --commit 019cf40 # short SHAs work too
|
||||
gitlint --commit HEAD~2 # as do special references
|
||||
gitlint --commit mybranch # lint latest commit on a branch
|
||||
```
|
||||
|
||||
You can also lint multiple commits at once like so:
|
||||
You can also lint multiple commits using `--commits` (plural):
|
||||
|
||||
```sh
|
||||
# Lint a specific commit range:
|
||||
gitlint --commits "019cf40...d6bc75a"
|
||||
# You can also use git's special references:
|
||||
# Lint all commits on a branch
|
||||
gitlint --commits mybranch
|
||||
# Lint all commits that are different between a branch and your main branch
|
||||
gitlint --commits "main..mybranch"
|
||||
# Use git's special references
|
||||
gitlint --commits "origin..HEAD"
|
||||
|
||||
# You can also pass multiple, comma separated commit hashes:
|
||||
gitlint --commits 019cf40,c50eb150,d6bc75a
|
||||
# These can include special references as well
|
||||
gitlint --commits HEAD~1,mybranch-name,origin/main,d6bc75a
|
||||
```
|
||||
|
||||
The `--commits` flag takes a **single** refspec argument or commit range. Basically, any range that is understood
|
||||
by [git rev-list](https://git-scm.com/docs/git-rev-list) as a single argument will work.
|
||||
|
||||
Alternatively, you can pass `--commits` a comma-separated list of commit hashes (both short and full-length SHAs work,
|
||||
as well as special references such as `HEAD` and branch names).
|
||||
Gitlint will treat these as pointers to **single** commits and lint these in the order you passed.
|
||||
|
||||
For cases where the `--commits` option doesn't provide the flexibility you need, you can always use a simple shell
|
||||
script to lint an arbitrary set of commits, like shown in the example below.
|
||||
|
||||
```sh
|
||||
#!/bin/sh
|
||||
|
||||
for commit in $(git rev-list master); do
|
||||
for commit in $(git rev-list my-branch); do
|
||||
echo "Commit $commit"
|
||||
gitlint --commit $commit
|
||||
echo "--------"
|
||||
|
@ -283,14 +347,14 @@ done
|
|||
|
||||
!!! note
|
||||
One downside to this approach is that you invoke gitlint once per commit vs. once per set of commits.
|
||||
This means you'll incur the gitlint startup time once per commit, making this approach rather slow if you want to
|
||||
This means you'll incur the gitlint startup time once per commit, making it rather slow if you want to
|
||||
lint a large set of commits. Always use `--commits` if you can to avoid this performance penalty.
|
||||
|
||||
|
||||
## Merge, fixup, squash and revert commits
|
||||
_Introduced in gitlint v0.7.0 (merge), v0.9.0 (fixup, squash) and v0.13.0 (revert)_
|
||||
_Introduced in gitlint v0.7.0 (merge), v0.9.0 (fixup, squash), v0.13.0 (revert) and v0.18.0 (fixup=amend)_
|
||||
|
||||
**Gitlint ignores merge, revert, fixup and squash commits by default.**
|
||||
**Gitlint ignores merge, revert, fixup, and squash commits by default.**
|
||||
|
||||
For merge and revert commits, the rationale for ignoring them is
|
||||
that most users keep git's default messages for these commits (i.e *Merge/Revert "[original commit message]"*).
|
||||
|
@ -300,14 +364,14 @@ For example, a common case is that *"Merge:"* being auto-prepended triggers a
|
|||
[title-max-length](rules.md#t1-title-max-length) violation. Most users don't want this, so we disable linting
|
||||
on Merge and Revert commits by default.
|
||||
|
||||
For [squash](https://git-scm.com/docs/git-commit#git-commit---squashltcommitgt) and [fixup](https://git-scm.com/docs/git-commit#git-commit---fixupltcommitgt) commits, the rationale is that these are temporary
|
||||
For [squash](https://git-scm.com/docs/git-commit#git-commit---squashltcommitgt) and [fixup](https://git-scm.com/docs/git-commit#git-commit---fixupltcommitgt) (including [fixup=amend](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---fixupamendrewordltcommitgt)) commits, the rationale is that these are temporary
|
||||
commits that will be squashed into a different commit, and hence the commit messages for these commits are very
|
||||
short-lived and not intended to make it into the final commit history. In addition, by prepending *"fixup!"* or
|
||||
*"squash!"* to your commit message, certain gitlint rules might be violated
|
||||
short-lived and not intended to make it into the final commit history. In addition, by prepending *"fixup!"*,
|
||||
*"amend!"* or *"squash!"* to your commit message, certain gitlint rules might be violated
|
||||
(e.g. [title-max-length](rules.md#t1-title-max-length)) which is often undesirable.
|
||||
|
||||
In case you *do* want to lint these commit messages, you can disable this behavior by setting the
|
||||
general `ignore-merge-commits`, `ignore-revert-commits`, `ignore-fixup-commits` or
|
||||
general `ignore-merge-commits`, `ignore-revert-commits`, `ignore-fixup-commits`, `ignore-fixup-amend-commits` or
|
||||
`ignore-squash-commits` option to `false`
|
||||
[using one of the various ways to configure gitlint](configuration.md).
|
||||
|
||||
|
@ -374,7 +438,7 @@ additional unique identifier (i.e. the rule *name*) during configuration.
|
|||
For example, by defining 2 `body-max-line-length` rules with different `line-length` options, you obviously create
|
||||
a conflicting situation. Gitlint does not do any resolution of such conflicts, it's up to you to make sure
|
||||
any configuration is non-conflicting. So caution advised!
|
||||
|
||||
|
||||
Defining a named rule is easy, for example using your `.gitlint` file:
|
||||
|
||||
```ini
|
||||
|
@ -400,7 +464,7 @@ When executing gitlint, you will see the violations from the default `title-must
|
|||
the violations caused by the additional Named Rules.
|
||||
|
||||
```sh
|
||||
$ gitlint
|
||||
$ gitlint
|
||||
1: T5 Title contains the word 'WIP' (case-insensitive): "WIP: foo wonderwoman hur bar"
|
||||
1: T5:This-Can_Be*Whatever$YouWant Title contains the word 'wonderwoman' (case-insensitive): "WIP: foo wonderwoman hur bar"
|
||||
1: T5:extra-words Title contains the word 'foo' (case-insensitive): "WIP: foo wonderwoman hur bar"
|
||||
|
@ -431,8 +495,8 @@ of violations counted by the exit code is 252. Note that gitlint does not have a
|
|||
it can detect, it will just always return with exit code 252 when the number of violations is greater than or equal
|
||||
to 252.
|
||||
|
||||
Exit Code | Description
|
||||
-----------|------------------------------------------------------------
|
||||
253 | Wrong invocation of the `gitlint` command.
|
||||
254 | Something went wrong when invoking git.
|
||||
255 | Invalid gitlint configuration
|
||||
| Exit Code | Description |
|
||||
| --------- | ------------------------------------------ |
|
||||
| 253 | Wrong invocation of the `gitlint` command. |
|
||||
| 254 | Something went wrong when invoking git. |
|
||||
| 255 | Invalid gitlint configuration |
|
||||
|
|
287
docs/rules.md
287
docs/rules.md
|
@ -8,43 +8,43 @@ In addition, you can also [write your own user-defined rule](user_defined_rules.
|
|||
what you're looking for.
|
||||
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|-----------------------------|-------------------|-------------------------------------------
|
||||
T1 | title-max-length | >= 0.1.0 | Title length must be < 72 chars.
|
||||
T2 | title-trailing-whitespace | >= 0.1.0 | Title cannot have trailing whitespace (space or tab)
|
||||
T3 | title-trailing-punctuation | >= 0.1.0 | Title cannot have trailing punctuation (?:!.,;)
|
||||
T4 | title-hard-tab | >= 0.1.0 | Title cannot contain hard tab characters (\t)
|
||||
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-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)
|
||||
B4 | body-first-line-empty | >= 0.1.0 | First line of the body (second line of commit message) must be empty
|
||||
B5 | body-min-length | >= 0.4.0 | Body length must be at least 20 characters
|
||||
B6 | body-is-missing | >= 0.4.0 | Body message must be specified
|
||||
B7 | body-changed-file-mention | >= 0.4.0 | Body must contain references to certain files if those files are changed in the last commit
|
||||
B8 | body-match-regex | >= 0.14.0 | Title must match a given regex (default: None)
|
||||
M1 | author-valid-email | >= 0.9.0 | Author email address must be a valid email address
|
||||
I1 | ignore-by-title | >= 0.10.0 | Ignore a commit based on matching its title
|
||||
I2 | ignore-by-body | >= 0.10.0 | Ignore a commit based on matching its body
|
||||
I3 | ignore-body-lines | >= 0.14.0 | Ignore certain lines in a commit body that match a regex
|
||||
I4 | ignore-by-author-name | >= 0.16.0 | Ignore a commit based on matching its author name
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | --------------------------- | --------------- | ------------------------------------------------------------------------------------------- |
|
||||
| T1 | title-max-length | >= 0.1.0 | Title length must be <= 72 chars. |
|
||||
| T2 | title-trailing-whitespace | >= 0.1.0 | Title cannot have trailing whitespace (space or tab) |
|
||||
| T3 | title-trailing-punctuation | >= 0.1.0 | Title cannot have trailing punctuation (?:!.,;) |
|
||||
| T4 | title-hard-tab | >= 0.1.0 | Title cannot contain hard tab characters (\t) |
|
||||
| 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-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) |
|
||||
| B4 | body-first-line-empty | >= 0.1.0 | First line of the body (second line of commit message) must be empty |
|
||||
| B5 | body-min-length | >= 0.4.0 | Body length must be at least 20 characters |
|
||||
| B6 | body-is-missing | >= 0.4.0 | Body message must be specified |
|
||||
| B7 | body-changed-file-mention | >= 0.4.0 | Body must contain references to certain files if those files are changed in the last commit |
|
||||
| B8 | body-match-regex | >= 0.14.0 | Body must match a given regex (default: None) |
|
||||
| M1 | author-valid-email | >= 0.9.0 | Author email address must be a valid email address |
|
||||
| I1 | ignore-by-title | >= 0.10.0 | Ignore a commit based on matching its title |
|
||||
| I2 | ignore-by-body | >= 0.10.0 | Ignore a commit based on matching its body |
|
||||
| I3 | ignore-body-lines | >= 0.14.0 | Ignore certain lines in a commit body that match a regex |
|
||||
| I4 | ignore-by-author-name | >= 0.16.0 | Ignore a commit based on matching its author name |
|
||||
|
||||
|
||||
|
||||
## T1: title-max-length
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|-----------------------------|-----------------|-------------------------------------------
|
||||
T1 | title-max-length | >= 0.1 | Title length must be < 72 chars.
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | ---------------- | --------------- | ------------------------------------ |
|
||||
| T1 | title-max-length | >= 0.1 | Title length must be <= 72 chars. |
|
||||
|
||||
### Options
|
||||
|
||||
Name | gitlint version | Default | Description
|
||||
---------------|-----------------|---------|----------------------------------
|
||||
line-length | >= 0.2 | 72 | Maximum allowed title length
|
||||
| Name | gitlint version | Default | Description |
|
||||
| ----------- | --------------- | ------- | ---------------------------- |
|
||||
| line-length | >= 0.2 | 72 | Maximum allowed title length |
|
||||
|
||||
### Examples
|
||||
|
||||
|
@ -59,39 +59,43 @@ line-length=72
|
|||
[title-max-length]
|
||||
line-length=120
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
## T2: title-trailing-whitespace
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|-----------------------------|-----------------|-------------------------------------------
|
||||
T2 | title-trailing-whitespace | >= 0.1 | Title cannot have trailing whitespace (space or tab)
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | ------------------------- | --------------- | ---------------------------------------------------- |
|
||||
| T2 | title-trailing-whitespace | >= 0.1 | Title cannot have trailing whitespace (space or tab) |
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
## T3: title-trailing-punctuation
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|-----------------------------|-----------------|-------------------------------------------
|
||||
T3 | title-trailing-punctuation | >= 0.1 | Title cannot have trailing punctuation (?:!.,;)
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | -------------------------- | --------------- | ----------------------------------------------- |
|
||||
| T3 | title-trailing-punctuation | >= 0.1 | Title cannot have trailing punctuation (?:!.,;) |
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
## T4: title-hard-tab
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|-----------------------------|-----------------|-------------------------------------------
|
||||
T4 | title-hard-tab | >= 0.1 | Title cannot contain hard tab characters (\t)
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | -------------- | --------------- | --------------------------------------------- |
|
||||
| T4 | title-hard-tab | >= 0.1 | Title cannot contain hard tab characters (\t) |
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
## T5: title-must-not-contain-word
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|-----------------------------|-----------------|-------------------------------------------
|
||||
T5 | title-must-not-contain-word | >= 0.1 | Title cannot contain certain words (default: "WIP")
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | --------------------------- | --------------- | --------------------------------------------------- |
|
||||
| T5 | title-must-not-contain-word | >= 0.1 | Title cannot contain certain words (default: "WIP") |
|
||||
|
||||
### Options
|
||||
|
||||
Name | gitlint version | Default | Description
|
||||
---------------|-----------------|---------|----------------------------------
|
||||
words | >= 0.3 | WIP | Comma-separated list of words that should not be used in the title. Matching is case insensitive
|
||||
| Name | gitlint version | Default | Description |
|
||||
| ----- | --------------- | ------- | ------------------------------------------------------------------------------------------------ |
|
||||
| words | >= 0.3 | WIP | Comma-separated list of words that should not be used in the title. Matching is case insensitive |
|
||||
|
||||
### Examples
|
||||
|
||||
|
@ -102,25 +106,28 @@ words | >= 0.3 | WIP | Comma-separated list of words that
|
|||
[title-must-not-contain-word]
|
||||
words=crap,darn,damn
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
## T6: title-leading-whitespace
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|-----------------------------|-----------------|-------------------------------------------
|
||||
T6 | title-leading-whitespace | >= 0.4 | Title cannot have leading whitespace (space or tab)
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | ------------------------ | --------------- | --------------------------------------------------- |
|
||||
| T6 | title-leading-whitespace | >= 0.4 | Title cannot have leading whitespace (space or tab) |
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
## T7: title-match-regex
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|-----------------------------|-----------------|-------------------------------------------
|
||||
T7 | title-match-regex | >= 0.5 | Title must match a given regex (default: .*)
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | ----------------- | --------------- | -------------------------------------------- |
|
||||
| T7 | title-match-regex | >= 0.5 | Title must match a given regex (default: .*) |
|
||||
|
||||
|
||||
### Options
|
||||
|
||||
Name | gitlint version | Default | Description
|
||||
---------------|-----------------|---------|----------------------------------
|
||||
regex | >= 0.5 | .* | [Python regex](https://docs.python.org/library/re.html) that the title should match.
|
||||
| Name | gitlint version | Default | Description |
|
||||
| ----- | --------------- | ------- | ------------------------------------------------------------------------------------ |
|
||||
| regex | >= 0.5 | .* | [Python regex](https://docs.python.org/library/re.html) that the title should match. |
|
||||
|
||||
### Examples
|
||||
|
||||
|
@ -131,19 +138,20 @@ regex | >= 0.5 | .* | [Python regex](https://docs.python.
|
|||
[title-match-regex]
|
||||
regex=^US[1-9][0-9]*
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
## T8: title-min-length ##
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|-----------------------------|-----------------|-------------------------------------------
|
||||
T1 | title-min-length | >= | Title length must be > 5 chars.
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | ---------------- | --------------- | ----------------------------------- |
|
||||
| T8 | title-min-length | >= 0.14.0 | Title length must be >= 5 chars. |
|
||||
|
||||
|
||||
### Options
|
||||
|
||||
Name | gitlint version | Default | Description
|
||||
---------------|-----------------|---------|----------------------------------
|
||||
min-length | >= 0.14.0 | 5 | Minimum required title length
|
||||
| Name | gitlint version | Default | Description |
|
||||
| ---------- | --------------- | ------- | ----------------------------- |
|
||||
| min-length | >= 0.14.0 | 5 | Minimum required title length |
|
||||
|
||||
### Examples
|
||||
|
||||
|
@ -154,18 +162,19 @@ min-length | >= 0.14.0 | 5 | Minimum required title length
|
|||
[title-min-length]
|
||||
min-length=3
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
## B1: body-max-line-length
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|-----------------------------|-----------------|-------------------------------------------
|
||||
B1 | body-max-line-length | >= 0.1 | Lines in the body must be < 80 chars
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | -------------------- | --------------- | ---------------------------------------- |
|
||||
| B1 | body-max-line-length | >= 0.1 | Lines in the body must be <= 80 chars |
|
||||
|
||||
### Options
|
||||
|
||||
Name | gitlint version | Default | Description
|
||||
---------------|-----------------|---------|----------------------------------
|
||||
line-length | >= 0.2 | 80 | Maximum allowed line length in the commit message body
|
||||
| Name | gitlint version | Default | Description |
|
||||
| ----------- | --------------- | ------- | ------------------------------------------------------ |
|
||||
| line-length | >= 0.2 | 80 | Maximum allowed line length in the commit message body |
|
||||
|
||||
### Examples
|
||||
|
||||
|
@ -180,38 +189,43 @@ line-length=120
|
|||
[body-max-line-length]
|
||||
line-length=72
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
## B2: body-trailing-whitespace
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|-----------------------------|-----------------|-------------------------------------------
|
||||
B2 | body-trailing-whitespace | >= 0.1 | Body cannot have trailing whitespace (space or tab)
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | ------------------------ | --------------- | --------------------------------------------------- |
|
||||
| B2 | body-trailing-whitespace | >= 0.1 | Body cannot have trailing whitespace (space or tab) |
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
## B3: body-hard-tab
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|-----------------------------|-----------------|-------------------------------------------
|
||||
B3 | body-hard-tab | >= 0.1 | Body cannot contain hard tab characters (\t)
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | ------------- | --------------- | -------------------------------------------- |
|
||||
| B3 | body-hard-tab | >= 0.1 | Body cannot contain hard tab characters (\t) |
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
## B4: body-first-line-empty
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|-----------------------------|-----------------|-------------------------------------------
|
||||
B4 | body-first-line-empty | >= 0.1 | First line of the body (second line of commit message) must be empty
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | --------------------- | --------------- | -------------------------------------------------------------------- |
|
||||
| B4 | body-first-line-empty | >= 0.1 | First line of the body (second line of commit message) must be empty |
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
## B5: body-min-length
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|-----------------------------|-----------------|-------------------------------------------
|
||||
B5 | body-min-length | >= 0.4 | Body length must be at least 20 characters. In versions >= 0.8.0, gitlint will not count newline characters.
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | --------------- | --------------- | ------------------------------------------------------------------------------------------------------------ |
|
||||
| B5 | body-min-length | >= 0.4 | Body length must be at least 20 characters. In versions >= 0.8.0, gitlint will not count newline characters. |
|
||||
|
||||
### Options ###
|
||||
|
||||
Name | gitlint version | Default | Description
|
||||
---------------|-----------------|---------|----------------------------------
|
||||
min-length | >= 0.4 | 20 | Minimum number of required characters in body
|
||||
| Name | gitlint version | Default | Description |
|
||||
| ---------- | --------------- | ------- | --------------------------------------------- |
|
||||
| min-length | >= 0.4 | 20 | Minimum number of required characters in body |
|
||||
|
||||
### Examples
|
||||
|
||||
|
@ -226,31 +240,34 @@ min-length=5
|
|||
[body-min-length]
|
||||
min-length=100
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
## B6: body-is-missing
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|-----------------------------|-----------------|-------------------------------------------
|
||||
B6 | body-is-missing | >= 0.4 | Body message must be specified
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | --------------- | --------------- | ------------------------------ |
|
||||
| B6 | body-is-missing | >= 0.4 | Body message must be specified |
|
||||
|
||||
|
||||
### Options
|
||||
|
||||
Name | gitlint version | Default | Description
|
||||
----------------------|-----------------|-----------|----------------------------------
|
||||
ignore-merge-commits | >= 0.4 | true | Whether this rule should be ignored during merge commits. Allowed values: true,false.
|
||||
| Name | gitlint version | Default | Description |
|
||||
| -------------------- | --------------- | ------- | ------------------------------------------------------------------------------------- |
|
||||
| ignore-merge-commits | >= 0.4 | true | Whether this rule should be ignored during merge commits. Allowed values: true,false. |
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
## B7: body-changed-file-mention
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|-----------------------------|-----------------|-------------------------------------------
|
||||
B7 | body-changed-file-mention | >= 0.4 | Body must contain references to certain files if those files are changed in the last commit
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | ------------------------- | --------------- | ------------------------------------------------------------------------------------------- |
|
||||
| B7 | body-changed-file-mention | >= 0.4 | Body must contain references to certain files if those files are changed in the last commit |
|
||||
|
||||
### Options
|
||||
|
||||
Name | gitlint version | Default | Description
|
||||
----------------------|-----------------|--------------|----------------------------------
|
||||
files | >= 0.4 | (empty) | Comma-separated list of files that need to an explicit mention in the commit message in case they are changed.
|
||||
| Name | gitlint version | Default | Description |
|
||||
| ----- | --------------- | ------- | -------------------------------------------------------------------------------------------------------------- |
|
||||
| files | >= 0.4 | (empty) | Comma-separated list of files that need to an explicit mention in the commit message in case they are changed. |
|
||||
|
||||
### Examples
|
||||
|
||||
|
@ -262,18 +279,19 @@ files | >= 0.4 | (empty) | Comma-separated list o
|
|||
[body-changed-file-mention]
|
||||
files=generated.xml,secrets.txt,private-key.pem
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
## B8: body-match-regex
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|-----------------------------|-----------------|-------------------------------------------
|
||||
B8 | body-match-regex | >= 0.14 | Body must match a given regex
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | ---------------- | --------------- | ----------------------------- |
|
||||
| B8 | body-match-regex | >= 0.14 | Body must match a given regex |
|
||||
|
||||
### Options
|
||||
|
||||
Name | gitlint version | Default | Description
|
||||
----------------------|-----------------|--------------|----------------------------------
|
||||
regex | >= 0.14 | None | [Python regex](https://docs.python.org/library/re.html) that the title should match.
|
||||
| Name | gitlint version | Default | Description |
|
||||
| ----- | --------------- | ------- | ----------------------------------------------------------------------------------- |
|
||||
| regex | >= 0.14 | None | [Python regex](https://docs.python.org/library/re.html) that the body should match. |
|
||||
|
||||
### Examples
|
||||
|
||||
|
@ -288,12 +306,13 @@ regex=Reviewed-By:(.*)$
|
|||
[body-match-regex]
|
||||
regex=(*.)Foo(.*)
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
## M1: author-valid-email
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|-----------------------------|-----------------|-------------------------------------------
|
||||
M1 | author-valid-email | >= 0.8.3 | Author email address must be a valid email address
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | ------------------ | --------------- | -------------------------------------------------- |
|
||||
| M1 | author-valid-email | >= 0.8.3 | Author email address must be a valid email address |
|
||||
|
||||
!!! note
|
||||
Email addresses are [notoriously hard to validate and the official email valid spec is often too loose for any real world application](http://stackoverflow.com/a/201378/381010).
|
||||
|
@ -303,9 +322,9 @@ M1 | author-valid-email | >= 0.8.3 | Author email address mus
|
|||
|
||||
### Options
|
||||
|
||||
Name | gitlint version | Default | Description
|
||||
----------------------|-------------------|------------------------------|----------------------------------
|
||||
regex | >= 0.9.0 | `[^@ ]+@[^@ ]+\.[^@ ]+` | [Python regex](https://docs.python.org/library/re.html) the commit author email address is matched against
|
||||
| Name | gitlint version | Default | Description |
|
||||
| ----- | --------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------- |
|
||||
| regex | >= 0.9.0 | `[^@ ]+@[^@ ]+\.[^@ ]+` | [Python regex](https://docs.python.org/library/re.html) the commit author email address is matched against |
|
||||
|
||||
|
||||
### Examples
|
||||
|
@ -317,20 +336,21 @@ regex | >= 0.9.0 | `[^@ ]+@[^@ ]+\.[^@ ]+` | [Python
|
|||
[author-valid-email]
|
||||
regex=[^@]+@foo.com
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
## I1: ignore-by-title
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|-----------------------------|-----------------|-------------------------------------------
|
||||
I1 | ignore-by-title | >= 0.10.0 | Ignore a commit based on matching its title.
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | --------------- | --------------- | -------------------------------------------- |
|
||||
| I1 | ignore-by-title | >= 0.10.0 | Ignore a commit based on matching its title. |
|
||||
|
||||
|
||||
### Options
|
||||
|
||||
Name | gitlint version | Default | Description
|
||||
----------------------|-------------------|------------------------------|----------------------------------
|
||||
regex | >= 0.10.0 | None | [Python regex](https://docs.python.org/library/re.html) to match against commit title. On match, the commit will be ignored.
|
||||
ignore | >= 0.10.0 | all | Comma-separated list of rule names or ids to ignore when this rule is matched.
|
||||
| Name | gitlint version | Default | Description |
|
||||
| ------ | --------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
||||
| regex | >= 0.10.0 | None | [Python regex](https://docs.python.org/library/re.html) to match against commit title. On match, the commit will be ignored. |
|
||||
| ignore | >= 0.10.0 | all | Comma-separated list of rule names or ids to ignore when this rule is matched. |
|
||||
|
||||
### Examples
|
||||
|
||||
|
@ -345,20 +365,21 @@ ignore=title-max-length,body-min-length
|
|||
# ignore all rules by setting ignore to 'all'
|
||||
# ignore=all
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
## I2: ignore-by-body
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|-----------------------------|-----------------|-------------------------------------------
|
||||
I2 | ignore-by-body | >= 0.10.0 | Ignore a commit based on matching its body.
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | -------------- | --------------- | ------------------------------------------- |
|
||||
| I2 | ignore-by-body | >= 0.10.0 | Ignore a commit based on matching its body. |
|
||||
|
||||
|
||||
### Options
|
||||
|
||||
Name | gitlint version | Default | Description
|
||||
----------------------|-------------------|------------------------------|----------------------------------
|
||||
regex | >= 0.10.0 | None | [Python regex](https://docs.python.org/library/re.html) to match against each line of the body. On match, the commit will be ignored.
|
||||
ignore | >= 0.10.0 | all | Comma-separated list of rule names or ids to ignore when this rule is matched.
|
||||
| Name | gitlint version | Default | Description |
|
||||
| ------ | --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| regex | >= 0.10.0 | None | [Python regex](https://docs.python.org/library/re.html) to match against each line of the body. On match, the commit will be ignored. |
|
||||
| ignore | >= 0.10.0 | all | Comma-separated list of rule names or ids to ignore when this rule is matched. |
|
||||
|
||||
### Examples
|
||||
|
||||
|
@ -376,19 +397,20 @@ ignore=all
|
|||
regex=(.*)release(.*)
|
||||
ignore=T1,body-min-length,B6
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
## I3: ignore-body-lines
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|-----------------------------|-----------------|-------------------------------------------
|
||||
I3 | ignore-body-lines | >= 0.14.0 | Ignore certain lines in a commit body that match a regex.
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | ----------------- | --------------- | --------------------------------------------------------- |
|
||||
| I3 | ignore-body-lines | >= 0.14.0 | Ignore certain lines in a commit body that match a regex. |
|
||||
|
||||
|
||||
### Options
|
||||
|
||||
Name | gitlint version | Default | Description
|
||||
----------------------|-------------------|------------------------------|----------------------------------
|
||||
regex | >= 0.14.0 | None | [Python regex](https://docs.python.org/library/re.html) to match against each line of the body. On match, that line will be ignored by gitlint (the rest of the body will still be linted).
|
||||
| Name | gitlint version | Default | Description |
|
||||
| ----- | --------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| regex | >= 0.14.0 | None | [Python regex](https://docs.python.org/library/re.html) to match against each line of the body. On match, that line will be ignored by gitlint (the rest of the body will still be linted). |
|
||||
|
||||
### Examples
|
||||
|
||||
|
@ -407,19 +429,20 @@ regex=(^Co-Authored-By)|(^Signed-off-by)
|
|||
[ignore-body-lines]
|
||||
regex=(.*)foobar(.*)
|
||||
```
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
## I4: ignore-by-author-name
|
||||
|
||||
ID | Name | gitlint version | Description
|
||||
------|---------------------------|-----------------|-------------------------------------------
|
||||
I4 | ignore-by-author-name | >= 0.16.0 | Ignore a commit based on matching its author name.
|
||||
| ID | Name | gitlint version | Description |
|
||||
| --- | --------------------- | --------------- | -------------------------------------------------- |
|
||||
| I4 | ignore-by-author-name | >= 0.16.0 | Ignore a commit based on matching its author name. |
|
||||
|
||||
### Options
|
||||
|
||||
Name | gitlint version | Default | Description
|
||||
----------------------|-------------------|------------------------------|----------------------------------
|
||||
regex | >= 0.16.0 | None | [Python regex](https://docs.python.org/library/re.html) to match against the commit author name. On match, the commit will be ignored.
|
||||
ignore | >= 0.16.0 | all | Comma-separated list of rule names or ids to ignore when this rule is matched.
|
||||
| Name | gitlint version | Default | Description |
|
||||
| ------ | --------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| regex | >= 0.16.0 | None | [Python regex](https://docs.python.org/library/re.html) to match against the commit author name. On match, the commit will be ignored. |
|
||||
| ignore | >= 0.16.0 | all | Comma-separated list of rule names or ids to ignore when this rule is matched. |
|
||||
|
||||
### Examples
|
||||
|
||||
|
@ -435,4 +458,4 @@ regex=dependabot
|
|||
[ignore-by-author-name]
|
||||
regex=(.*)\[bot\](.*)
|
||||
ignore=T1,body-min-length,B6
|
||||
```
|
||||
```
|
||||
|
|
|
@ -179,27 +179,33 @@ Both `CommitRule`s and `LineRule`s take a `commit` object in their `validate(...
|
|||
The table below outlines the various attributes of that commit object that can be used during validation.
|
||||
|
||||
|
||||
Property | Type | Description
|
||||
-------------------------------| ---------------|-------------------
|
||||
commit.message | object | Python object representing the commit message
|
||||
commit.message.original | string | Original commit message as returned by git
|
||||
commit.message.full | string | Full commit message, with comments (lines starting with #) removed.
|
||||
commit.message.title | string | Title/subject of the commit message: the first line
|
||||
commit.message.body | string[] | List of lines in the body of the commit message (i.e. starting from the second line)
|
||||
commit.author_name | string | Name of the author, result of `git log --pretty=%aN`
|
||||
commit.author_email | string | Email of the author, result of `git log --pretty=%aE`
|
||||
commit.date | datetime | Python `datetime` object representing the time of commit
|
||||
commit.is_merge_commit | boolean | Boolean indicating whether the commit is a merge commit or not.
|
||||
commit.is_revert_commit | boolean | Boolean indicating whether the commit is a revert commit or not.
|
||||
commit.is_fixup_commit | boolean | Boolean indicating whether the commit is a fixup commit or not.
|
||||
commit.is_squash_commit | boolean | Boolean indicating whether the commit is a squash commit or not.
|
||||
commit.parents | string[] | List of parent commit `sha`s (only for merge commits).
|
||||
commit.changed_files | string[] | List of files changed in the commit (relative paths).
|
||||
commit.branches | string[] | List of branch names the commit is part of
|
||||
commit.context | object | Object pointing to the bigger git context that the commit is part of
|
||||
commit.context.current_branch | string | Name of the currently active branch (of local repo)
|
||||
commit.context.repository_path | string | Absolute path pointing to the git repository being linted
|
||||
commit.context.commits | object[] | List of commits gitlint is acting on, NOT all commits in the repo.
|
||||
| Property | Type | Description |
|
||||
| -------------------------------------------- | --------------------------------- | ------------------------------------------------------------------------------------ |
|
||||
| commit | `GitCommit` | Python object representing the commit |
|
||||
| commit.message | `GitCommitMessage` | Python object representing the commit message |
|
||||
| commit.message.original | `str` | Original commit message as returned by git |
|
||||
| commit.message.full | `str` | Full commit message, with comments (lines starting with #) removed. |
|
||||
| commit.message.title | `str` | Title/subject of the commit message: the first line |
|
||||
| commit.message.body | `str[]` | List of lines in the body of the commit message (i.e. starting from the second line) |
|
||||
| commit.author_name | `str` | Name of the author, result of `git log --pretty=%aN` |
|
||||
| commit.author_email | `str` | Email of the author, result of `git log --pretty=%aE` |
|
||||
| commit.date | `datetime.datetime` | Python `datetime` object representing the time of commit |
|
||||
| commit.is_merge_commit | `bool` | Boolean indicating whether the commit is a merge commit or not. |
|
||||
| commit.is_revert_commit | `bool` | Boolean indicating whether the commit is a revert commit or not. |
|
||||
| commit.is_fixup_commit | `bool` | Boolean indicating whether the commit is a fixup commit or not. |
|
||||
| commit.is_fixup_amend_commit | `bool` | Boolean indicating whether the commit is a (fixup) amend commit or not. |
|
||||
| commit.is_squash_commit | `bool` | Boolean indicating whether the commit is a squash commit or not. |
|
||||
| commit.parents | `str[]` | List of parent commit `sha`s (only for merge commits). |
|
||||
| commit.changed_files | `str[]` | List of files changed in the commit (relative paths). |
|
||||
| commit.changed_files_stats | `dict[str, GitChangedFilesStats]` | Dictionary mapping the changed files to a `GitChangedFilesStats` objects |
|
||||
| commit.changed_files_stats["path"].filepath | `pathlib.Path` | Relative path (compared to repo root) of the file that was changed. |
|
||||
| commit.changed_files_stats["path"].additions | `int` | Number of additions in the file. |
|
||||
| commit.changed_files_stats["path"].deletions | `int` | Number of deletions in the file. |
|
||||
| commit.branches | `str[]` | List of branch names the commit is part of |
|
||||
| commit.context | `GitContext` | Object pointing to the bigger git context that the commit is part of |
|
||||
| commit.context.current_branch | `str` | Name of the currently active branch (of local repo) |
|
||||
| commit.context.repository_path | `str` | Absolute path pointing to the git repository being linted |
|
||||
| commit.context.commits | `GitCommit[]` | List of commits gitlint is acting on, NOT all commits in the repo. |
|
||||
|
||||
## Violations
|
||||
In order to let gitlint know that there is a violation in the commit being linted, users should have the `validate(...)`
|
||||
|
@ -216,12 +222,12 @@ RuleViolation(rule_id, message, content=None, line_nr=None):
|
|||
```
|
||||
With the parameters meaning the following:
|
||||
|
||||
Parameter | Type | Description
|
||||
--------------|---------|--------------------------------
|
||||
rule_id | string | Rule's unique string id
|
||||
message | string | Short description of the violation
|
||||
content | string | (optional) the violating part of commit or line
|
||||
line_nr | int | (optional) line number in the commit message where the violation occurs. **Automatically set to the correct line number for `LineRule`s if not set explicitly.**
|
||||
| Parameter | Type | Description |
|
||||
| --------- | ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| rule_id | `str` | Rule's unique string id |
|
||||
| message | `str` | Short description of the violation |
|
||||
| content | `str` | (optional) the violating part of commit or line |
|
||||
| line_nr | `int` | (optional) line number in the commit message where the violation occurs. **Automatically set to the correct line number for `LineRule`s if not set explicitly.** |
|
||||
|
||||
A typical `validate(...)` implementation for a `CommitRule` would then be as follows:
|
||||
```python
|
||||
|
@ -281,14 +287,14 @@ As `options_spec` is a list, you can obviously have multiple options per rule. T
|
|||
|
||||
Gitlint supports a variety of different option types, all can be imported from `gitlint.options`:
|
||||
|
||||
Option Class | Use for
|
||||
------------------|--------------
|
||||
`StrOption ` | Strings
|
||||
`IntOption` | Integers. `IntOption` takes an optional `allow_negative` parameter if you want to allow negative integers.
|
||||
`BoolOption` | Booleans. Valid values: `true`, `false`. Case-insensitive.
|
||||
`ListOption` | List of strings. Comma separated.
|
||||
`PathOption` | Directory or file path. Takes an optional `type` parameter for specifying path type (`file`, `dir` (=default) or `both`).
|
||||
`RegexOption` | String representing a [Python-style regex](https://docs.python.org/library/re.html) - compiled and validated before rules are applied.
|
||||
| Option Class | Use for |
|
||||
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `StrOption ` | Strings |
|
||||
| `IntOption` | Integers. `IntOption` takes an optional `allow_negative` parameter if you want to allow negative integers. |
|
||||
| `BoolOption` | Booleans. Valid values: `true`, `false`. Case-insensitive. |
|
||||
| `ListOption` | List of strings. Comma separated. |
|
||||
| `PathOption` | Directory or file path. Takes an optional `type` parameter for specifying path type (`file`, `dir` (=default) or `both`). |
|
||||
| `RegexOption` | String representing a [Python-style regex](https://docs.python.org/library/re.html) - compiled and validated before rules are applied. |
|
||||
|
||||
!!! note
|
||||
Gitlint currently does not support options for all possible types (e.g. float, list of int, etc).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue