summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--docs/configuration.md19
-rw-r--r--docs/contributing.md13
-rw-r--r--docs/index.md13
-rw-r--r--docs/rules.md4
-rw-r--r--docs/user_defined_rules.md7
5 files changed, 31 insertions, 25 deletions
diff --git a/docs/configuration.md b/docs/configuration.md
index 78224c1..50c4e63 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -80,7 +80,7 @@ min-length=5
words=wip
[title-match-regex]
-# python like regex (https://docs.python.org/2/library/re.html) that the
+# python like regex (https://docs.python.org/3/library/re.html) that the
# commit-msg title must be matched to.
# Note that the regex can contradict with other rules if not used correctly
# (e.g. title-must-not-contain-word).
@@ -100,8 +100,8 @@ ignore-merge-commits=false
[body-changed-file-mention]
# List of files that need to be explicitly mentioned in the body when they are changed
# This is useful for when developers often erroneously edit certain files or git submodules.
-# By specifying this rule, developers can only change the file when they explicitly reference
-# it in the commit message.
+# By specifying this rule, developers can only change the file when they explicitly
+# reference it in the commit message.
files=gitlint/rules.py,README.md
[body-match-regex]
@@ -110,9 +110,10 @@ files=gitlint/rules.py,README.md
regex=My-Commit-Tag: foo$
[author-valid-email]
-# python like regex (https://docs.python.org/2/library/re.html) that the
+# python like regex (https://docs.python.org/3/library/re.html) that the
# commit author email address should be matched to
-# E.g.: For example, use the following regex if you only want to allow email addresses from foo.com
+# E.g.: For example, use the following regex if you only want to allow email
+# addresses from foo.com
regex=[^@]+@foo.com
[ignore-by-title]
@@ -330,8 +331,10 @@ Default value | gitlint version | commandline flag | environment
```sh
# CLI
gitlint --contrib=contrib-title-conventional-commits,CC1
-gitlint -c general.contrib=contrib-title-conventional-commits,CC1 # different way of doing the same
-GITLINT_CONTRIB=contrib-title-conventional-commits,CC1 gitlint # using env variable
+# 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
```
```ini
#.gitlint
@@ -341,7 +344,7 @@ 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`.
+Fetch additional meta-data from the local repository when manually passing a commit message to gitlint via stdin or `--commit-msg`.
Default value | gitlint version | commandline flag | environment variable
---------------|------------------|-------------------|-----------------------
diff --git a/docs/contributing.md b/docs/contributing.md
index f0d2d30..e58378c 100644
--- a/docs/contributing.md
+++ b/docs/contributing.md
@@ -34,7 +34,8 @@ and it's likely that your PR will be merged and released a lot sooner. Thanks!
## Development
-There is a Vagrantfile in this repository that can be used for development.
+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
@@ -51,7 +52,7 @@ python setup.py develop
To run tests:
```sh
./run_tests.sh # run unit tests and print test coverage
-./run_test.sh gitlint/tests/test_body_rules.py::BodyRuleTests::test_body_missing # run a single test
+./run_tests.sh gitlint/tests/rules/test_body_rules.py::BodyRuleTests::test_body_missing # run a single test
./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)
@@ -63,12 +64,12 @@ To run tests:
./run_tests.sh --all # Run unit, integration, pep8 and gitlint checks
```
-The `Vagrantfile` comes with `virtualenv`s for python 2.7, 3.5, 3.6, 3.7, 3.8, 3.9 and pypy2.
+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 27 # Run the unit tests against Python 2.7
-./run_tests.sh --envs 27,37,pypy2 # Run the unit tests against Python 2.7, Python 3.7 and Pypy2
-./run_tests.sh --envs 27,37 --pep8 # Run pep8 checks against Python 2.7 and Python 3.7 (also works for --git, --integration, --pep8, --stats and --lint.
+./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
```
diff --git a/docs/index.md b/docs/index.md
index c179c9e..5b371bf 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -15,7 +15,7 @@ Great for use as a [commit-msg git hook](#using-gitlint-as-a-commit-msg-hook) or
!!! important
- **Gitlint will soon be dropping support for Python 2.7 and Python 3.5 as they [have reached End-Of-Life](https://endoflife.date/python)**.
+ **Gitlint no longer supports Python 2.7 and Python 3.5 as they [have reached End-Of-Life](https://endoflife.date/python). The last gitlint version to support Python 2.7 and Python 3.5 is `0.14.0` (released on October 24th, 2020).**
## Features
- **Commit message hook**: [Auto-trigger validations against new commit message right when you're committing](#using-gitlint-as-a-commit-msg-hook). Also [works with pre-commit](#using-gitlint-through-pre-commit).
@@ -39,8 +39,8 @@ useful throughout the years.
pip install gitlint
# macOS
-brew tap rockyluke/devops
brew install gitlint
+sudo port install gitlint # alternative using macports
# Ubuntu
apt-get install gitlint
@@ -219,11 +219,14 @@ your `.pre-commit-config.yaml` file like so:
rev: # Fill in a tag / sha here
hooks:
- id: gitlint
- stages: [commit-msg]
- entry: gitlint
args: [--contrib=CT1, --msg-filename]
```
+!!! important
+
+ You need to add `--msg-filename` at the end of your custom `args` list as the gitlint-hook will fail otherwise.
+
+
## 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.
@@ -426,4 +429,4 @@ Exit Code | Description
-----------|------------------------------------------------------------
253 | Wrong invocation of the `gitlint` command.
254 | Something went wrong when invoking git.
-255 | Invalid gitlint configuration \ No newline at end of file
+255 | Invalid gitlint configuration
diff --git a/docs/rules.md b/docs/rules.md
index 178f962..23b8e91 100644
--- a/docs/rules.md
+++ b/docs/rules.md
@@ -255,8 +255,8 @@ files | >= 0.4 | (empty) | Comma-separated list o
#### .gitlint
```ini
-# Prevent that certain sensitive files are committed by mistake by forcing users to mention them explicitly if they're
-# deliberately changing them
+# Prevent that certain sensitive files are committed by mistake by forcing
+# users to mention them explicitly if they're deliberately changing them
[body-changed-file-mention]
files=generated.xml,secrets.txt,private-key.pem
```
diff --git a/docs/user_defined_rules.md b/docs/user_defined_rules.md
index 13ea544..fd944d1 100644
--- a/docs/user_defined_rules.md
+++ b/docs/user_defined_rules.md
@@ -152,7 +152,7 @@ class SpecialChars(LineRule):
# options can be accessed by looking them up by their name in self.options
for char in self.options['special-chars'].value:
if char in line:
- msg = "Title contains the special character '{0}'".format(char)
+ msg = f"Title contains the special character '{char}'"
violation = RuleViolation(self.id, msg, line)
violations.append(violation)
@@ -262,8 +262,7 @@ class BodyMaxLineCount(CommitRule):
line_count = len(commit.message.body)
max_line_count = self.options['max-line-count'].value
if line_count > max_line_count:
- message = "Body contains too many lines ({0} > {1})".format(line_count,
- max_line_count)
+ message = f"Body contains too many lines ({line_count} > {max_line_count})"
return [RuleViolation(self.id, message, line_nr=1)]
```
@@ -371,7 +370,7 @@ class ReleaseConfigurationRule(ConfigurationRule):
# You can add any extra properties you want to the commit object,
# these will be available later on in all rules.
- commit.my_property = u"This is my property"
+ commit.my_property = "This is my property"
```
For all available properties and methods on the `config` object, have a look at the