Merging upstream version 0.17.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
c90d4ccbc4
commit
435cb3a48d
128 changed files with 72 additions and 100 deletions
|
@ -3,4 +3,4 @@ fail_under = 97
|
||||||
|
|
||||||
[run]
|
[run]
|
||||||
branch = true
|
branch = true
|
||||||
omit=*dist-packages*,*site-packages*,gitlint/tests/*,.venv/*,*virtualenv*
|
omit=*dist-packages*,*site-packages*,gitlint-core/gitlint/tests/*,.venv/*,*virtualenv*
|
||||||
|
|
10
.github/workflows/checks.yml
vendored
10
.github/workflows/checks.yml
vendored
|
@ -109,13 +109,13 @@ jobs:
|
||||||
run: gitlint --version
|
run: gitlint --version
|
||||||
|
|
||||||
- name: Tests (sanity)
|
- name: Tests (sanity)
|
||||||
run: tools\windows\run_tests.bat "gitlint\tests\cli\test_cli.py::CLITests::test_lint"
|
run: tools\windows\run_tests.bat "gitlint-core\gitlint\tests\cli\test_cli.py::CLITests::test_lint"
|
||||||
|
|
||||||
- name: Tests (ignore cli\*)
|
- name: Tests (ignore cli\*)
|
||||||
run: pytest --ignore gitlint\tests\cli -rw -s gitlint
|
run: pytest --ignore gitlint-core\gitlint\tests\cli -rw -s gitlint-core
|
||||||
|
|
||||||
- name: Tests (test_cli.py only - continue-on-error:true)
|
- name: Tests (test_cli.py only - continue-on-error:true)
|
||||||
run: tools\windows\run_tests.bat "gitlint\tests\cli\test_cli.py"
|
run: tools\windows\run_tests.bat "gitlint-core\gitlint\tests\cli\test_cli.py"
|
||||||
continue-on-error: true # Known to fail at this point
|
continue-on-error: true # Known to fail at this point
|
||||||
|
|
||||||
- name: Tests (all - continue-on-error:true)
|
- name: Tests (all - continue-on-error:true)
|
||||||
|
@ -127,10 +127,10 @@ jobs:
|
||||||
continue-on-error: true # Known to fail at this point
|
continue-on-error: true # Known to fail at this point
|
||||||
|
|
||||||
- name: PEP8
|
- name: PEP8
|
||||||
run: flake8 gitlint qa examples
|
run: flake8 gitlint-core qa examples
|
||||||
|
|
||||||
- name: PyLint
|
- name: PyLint
|
||||||
run: pylint gitlint qa --rcfile=".pylintrc" -r n
|
run: pylint gitlint-core\gitlint qa --rcfile=".pylintrc" -r n
|
||||||
|
|
||||||
# Re-add git version control so we can run gitlint on itself.
|
# Re-add git version control so we can run gitlint on itself.
|
||||||
- name: Re-add git version control to code
|
- name: Re-add git version control to code
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
- id: gitlint
|
- id: gitlint
|
||||||
name: gitlint
|
name: gitlint
|
||||||
language: python
|
language: python
|
||||||
|
additional_dependencies: ["./gitlint-core[trusted-deps]"]
|
||||||
entry: gitlint
|
entry: gitlint
|
||||||
args: [--staged, --msg-filename]
|
args: [--staged, --msg-filename]
|
||||||
stages: [commit-msg]
|
stages: [commit-msg]
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
# Changelog #
|
# Changelog #
|
||||||
|
|
||||||
|
## v0.17.0 (2021-11-28) ##
|
||||||
|
Contributors:
|
||||||
|
Special thanks to all contributors for this release, in particular [andersk](https://github.com/andersk) and [sigmavirus24](https://github.com/sigmavirus24).
|
||||||
|
|
||||||
|
- Gitlint is now split in 2 packages: `gitlint` and `gitlint-core`. This allows users to install gitlint without pinned dependencies (which is the default) ([#162](https://github.com/jorisroovers/gitlint/issues/162))
|
||||||
|
- Under-the-hood: dependencies updated
|
||||||
## v0.16.0 (2021-10-08) ##
|
## v0.16.0 (2021-10-08) ##
|
||||||
|
|
||||||
Contributors:
|
Contributors:
|
||||||
|
|
|
@ -3,5 +3,5 @@ include LICENSE
|
||||||
exclude Vagrantfile
|
exclude Vagrantfile
|
||||||
exclude *.yml *.sh *.txt
|
exclude *.yml *.sh *.txt
|
||||||
recursive-exclude examples *
|
recursive-exclude examples *
|
||||||
recursive-exclude gitlint/tests *
|
recursive-exclude gitlint-core *
|
||||||
recursive-exclude qa *
|
recursive-exclude qa *
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
mkdocs==1.2.2
|
mkdocs==1.2.3
|
|
@ -108,7 +108,7 @@ ignore-merge-commits=false
|
||||||
# This is useful for when developers often erroneously edit certain files or git submodules.
|
# 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
|
# By specifying this rule, developers can only change the file when they explicitly
|
||||||
# reference it in the commit message.
|
# reference it in the commit message.
|
||||||
files=gitlint/rules.py,README.md
|
files=gitlint-core/gitlint/rules.py,README.md
|
||||||
|
|
||||||
[body-match-regex]
|
[body-match-regex]
|
||||||
# python-style regex that the commit-msg body must match.
|
# python-style regex that the commit-msg body must match.
|
||||||
|
|
|
@ -13,7 +13,7 @@ that's open to a lot of change and input.
|
||||||
|
|
||||||
When contributing code, please consider all the parts that are typically required:
|
When contributing code, please consider all the parts that are typically required:
|
||||||
|
|
||||||
- [Unit tests](https://github.com/jorisroovers/gitlint/tree/main/gitlint/tests) (automatically
|
- [Unit tests](https://github.com/jorisroovers/gitlint/tree/main/gitlint-core/gitlint/tests) (automatically
|
||||||
[enforced by CI](https://github.com/jorisroovers/gitlint/actions)). Please consider writing
|
[enforced by CI](https://github.com/jorisroovers/gitlint/actions)). Please consider writing
|
||||||
new ones for your functionality, not only updating existing ones to make the build pass.
|
new ones for your functionality, not only updating existing ones to make the build pass.
|
||||||
- [Integration tests](https://github.com/jorisroovers/gitlint/tree/main/qa) (also automatically
|
- [Integration tests](https://github.com/jorisroovers/gitlint/tree/main/qa) (also automatically
|
||||||
|
@ -118,8 +118,8 @@ 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)**. 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.
|
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/contrib/rules) directory.
|
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/tests/contrib/rules).
|
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).
|
||||||
4. **Write documentation**. In particular, you should update the [gitlint/docs/contrib_rules.md](https://github.com/jorisroovers/gitlint/blob/main/docs/contrib_rules.md) file with details on your Contrib rule.
|
4. **Write documentation**. In particular, you should update the [gitlint/docs/contrib_rules.md](https://github.com/jorisroovers/gitlint/blob/main/docs/contrib_rules.md) file with details on your Contrib rule.
|
||||||
5. **Create a Pull Request**: code review typically requires a bit of back and forth. Thanks for your contribution!
|
5. **Create a Pull Request**: code review typically requires a bit of back and forth. Thanks for your contribution!
|
||||||
|
|
||||||
|
|
|
@ -315,7 +315,7 @@ general `ignore-merge-commits`, `ignore-revert-commits`, `ignore-fixup-commits`
|
||||||
|
|
||||||
You can configure gitlint to ignore specific commits or parts of a commit.
|
You can configure gitlint to ignore specific commits or parts of a commit.
|
||||||
|
|
||||||
One way to do this, is to by [adding a gitline-ignore line to your commit message](configuration.md#commit-specific-config).
|
One way to do this, is by [adding a gitlint-ignore line to your commit message](configuration.md#commit-specific-config).
|
||||||
|
|
||||||
If you have a case where you want to ignore a certain type of commits all-together, you can
|
If you have a case where you want to ignore a certain type of commits all-together, you can
|
||||||
use gitlint's *ignore* rules.
|
use gitlint's *ignore* rules.
|
||||||
|
|
|
@ -374,7 +374,7 @@ class ReleaseConfigurationRule(ConfigurationRule):
|
||||||
```
|
```
|
||||||
|
|
||||||
For all available properties and methods on the `config` object, have a look at the
|
For all available properties and methods on the `config` object, have a look at the
|
||||||
[LintConfig class](https://github.com/jorisroovers/gitlint/blob/main/gitlint/config.py). Please do not use any
|
[LintConfig class](https://github.com/jorisroovers/gitlint/blob/main/gitlint-core/gitlint/config.py). Please do not use any
|
||||||
properties or methods starting with an underscore, as those are subject to change.
|
properties or methods starting with an underscore, as those are subject to change.
|
||||||
|
|
||||||
|
|
||||||
|
@ -385,7 +385,7 @@ As long as you stick with simple rules that are similar to the sample user-defin
|
||||||
should be able to discover and execute them. While clearly you can run any python code you want in your rules,
|
should be able to discover and execute them. While clearly you can run any python code you want in your rules,
|
||||||
you might run into some issues if you don't follow the conventions that gitlint requires.
|
you might run into some issues if you don't follow the conventions that gitlint requires.
|
||||||
|
|
||||||
While the [rule finding source-code](https://github.com/jorisroovers/gitlint/blob/main/gitlint/rule_finder.py) is the
|
While the [rule finding source-code](https://github.com/jorisroovers/gitlint/blob/main/gitlint-core/gitlint/rule_finder.py) is the
|
||||||
ultimate source of truth, here are some of the requirements that gitlint enforces.
|
ultimate source of truth, here are some of the requirements that gitlint enforces.
|
||||||
|
|
||||||
### Rule class requirements
|
### Rule class requirements
|
||||||
|
|
|
@ -55,4 +55,4 @@ ignore-merge-commits=false
|
||||||
# This is useful for when developers often erroneously edit certain files or git submodules.
|
# 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
|
# By specifying this rule, developers can only change the file when they explicitly reference
|
||||||
# it in the commit message.
|
# it in the commit message.
|
||||||
files=gitlint/rules.py,README.md
|
files=gitlint-core/gitlint/rules.py,README.md
|
||||||
|
|
1
gitlint-core/LICENSE
Symbolic link
1
gitlint-core/LICENSE
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../LICENSE
|
3
gitlint-core/MANIFEST.in
Normal file
3
gitlint-core/MANIFEST.in
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
include README.md
|
||||||
|
include LICENSE
|
||||||
|
recursive-exclude gitlint/tests *
|
1
gitlint-core/README.md
Symbolic link
1
gitlint-core/README.md
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../README.md
|
1
gitlint-core/gitlint/__init__.py
Normal file
1
gitlint-core/gitlint/__init__.py
Normal file
|
@ -0,0 +1 @@
|
||||||
|
__version__ = "0.17.0"
|
|
@ -428,7 +428,7 @@ class LintConfigBuilder:
|
||||||
f"'{config_option}' is an invalid configuration option. Use '<rule>.<option>=<value>'") from e
|
f"'{config_option}' is an invalid configuration option. Use '<rule>.<option>=<value>'") from e
|
||||||
|
|
||||||
def set_from_config_file(self, filename):
|
def set_from_config_file(self, filename):
|
||||||
""" Loads lint config from a ini-style config file """
|
""" Loads lint config from an ini-style config file """
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
raise LintConfigError(f"Invalid file path: {filename}")
|
raise LintConfigError(f"Invalid file path: {filename}")
|
||||||
self._config_path = os.path.realpath(filename)
|
self._config_path = os.path.realpath(filename)
|
|
@ -11,7 +11,7 @@ if [ $stdin_available -eq 1 ]; then
|
||||||
# Now that we know we have a functional tty, set stdin to it so we can ask the user questions :-)
|
# Now that we know we have a functional tty, set stdin to it so we can ask the user questions :-)
|
||||||
exec < /dev/tty
|
exec < /dev/tty
|
||||||
|
|
||||||
# On Windows, we need to explicitely set our stdout to the tty to make terminal editing work (e.g. vim)
|
# On Windows, we need to explicitly set our stdout to the tty to make terminal editing work (e.g. vim)
|
||||||
# See SO for windows detection in bash (slight modified to work on plain shell (not bash)):
|
# See SO for windows detection in bash (slight modified to work on plain shell (not bash)):
|
||||||
# https://stackoverflow.com/questions/394230/how-to-detect-the-os-from-a-bash-script
|
# https://stackoverflow.com/questions/394230/how-to-detect-the-os-from-a-bash-script
|
||||||
if [ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ] || [ "$OSTYPE" = "win32" ]; then
|
if [ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ] || [ "$OSTYPE" = "win32" ]; then
|
|
@ -45,7 +45,7 @@
|
||||||
# extra-path=examples/
|
# extra-path=examples/
|
||||||
|
|
||||||
# This is an example of how to configure the "title-max-length" rule and
|
# This is an example of how to configure the "title-max-length" rule and
|
||||||
# set the line-length it enforces to 80
|
# set the line-length it enforces to 50
|
||||||
# [title-max-length]
|
# [title-max-length]
|
||||||
# line-length=50
|
# line-length=50
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
# This is useful for when developers often erroneously edit certain files or git submodules.
|
# 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
|
# By specifying this rule, developers can only change the file when they explicitly reference
|
||||||
# it in the commit message.
|
# it in the commit message.
|
||||||
# files=gitlint/rules.py,README.md
|
# files=gitlint-core/gitlint/rules.py,README.md
|
||||||
|
|
||||||
# [body-match-regex]
|
# [body-match-regex]
|
||||||
# python-style regex that the commit-msg body must match.
|
# python-style regex that the commit-msg body must match.
|
|
@ -367,7 +367,7 @@ class GitContext(PropertyCache):
|
||||||
def from_local_repository(repository_path, refspec=None, commit_hash=None):
|
def from_local_repository(repository_path, refspec=None, commit_hash=None):
|
||||||
""" Retrieves the git context from a local git repository.
|
""" Retrieves the git context from a local git repository.
|
||||||
:param repository_path: Path to the git repository to retrieve the context from
|
:param repository_path: Path to the git repository to retrieve the context from
|
||||||
:param refspec: The commit(s) to retrieve (mutually exclusive with `commit_sha`)
|
:param refspec: The commit(s) to retrieve (mutually exclusive with `commit_hash`)
|
||||||
:param commit_hash: Hash of the commit to retrieve (mutually exclusive with `refspec`)
|
:param commit_hash: Hash of the commit to retrieve (mutually exclusive with `refspec`)
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -86,7 +86,7 @@ class BoolOption(RuleOption):
|
||||||
|
|
||||||
|
|
||||||
class ListOption(RuleOption):
|
class ListOption(RuleOption):
|
||||||
""" Option that is either a given list or a comma-separated string that can be splitted into a list when being set.
|
""" Option that is either a given list or a comma-separated string that can be split into a list when being set.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@allow_none
|
@allow_none
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This module implements a shim for the 'sh' library, mainly for use on Windows (sh is not supported on Windows).
|
This module implements a shim for the 'sh' library, mainly for use on Windows (sh is not supported on Windows).
|
||||||
We might consider removing the 'sh' dependency alltogether in the future, but 'sh' does provide a few
|
We might consider removing the 'sh' dependency altogether in the future, but 'sh' does provide a few
|
||||||
capabilities wrt dealing with more edge-case environments on *nix systems that are useful.
|
capabilities wrt dealing with more edge-case environments on *nix systems that are useful.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -33,7 +33,7 @@ class BaseTestCase(unittest.TestCase):
|
||||||
logging.getLogger('gitlint').setLevel(logging.DEBUG)
|
logging.getLogger('gitlint').setLevel(logging.DEBUG)
|
||||||
logging.getLogger('gitlint').handlers = [self.logcapture]
|
logging.getLogger('gitlint').handlers = [self.logcapture]
|
||||||
|
|
||||||
# Make sure we don't propagate anything to child loggers, we need to do this explicitely here
|
# Make sure we don't propagate anything to child loggers, we need to do this explicitly here
|
||||||
# because if you run a specific test file like test_lint.py, we won't be calling the setupLogging() method
|
# because if you run a specific test file like test_lint.py, we won't be calling the setupLogging() method
|
||||||
# in gitlint.cli that normally takes care of this
|
# in gitlint.cli that normally takes care of this
|
||||||
logging.getLogger('gitlint').propagate = False
|
logging.getLogger('gitlint').propagate = False
|
|
@ -19,7 +19,7 @@ class RuleCollectionTests(BaseTestCase):
|
||||||
|
|
||||||
self.assertEqual(len(collection), 1)
|
self.assertEqual(len(collection), 1)
|
||||||
self.assertDictEqual(collection._rules, OrderedDict({"my-rüle": expected}))
|
self.assertDictEqual(collection._rules, OrderedDict({"my-rüle": expected}))
|
||||||
# Need to explicitely compare expected attributes as the rule.__eq__ method does not compare these attributes
|
# Need to explicitly compare expected attributes as the rule.__eq__ method does not compare these attributes
|
||||||
self.assertEqual(collection._rules[expected.id].my_attr, expected.my_attr)
|
self.assertEqual(collection._rules[expected.id].my_attr, expected.my_attr)
|
||||||
self.assertEqual(collection._rules[expected.id].my_attr2, expected.my_attr2)
|
self.assertEqual(collection._rules[expected.id].my_attr2, expected.my_attr2)
|
||||||
|
|
|
@ -170,7 +170,7 @@ class UserRuleTests(BaseTestCase):
|
||||||
class MyRuleClass(parent_class):
|
class MyRuleClass(parent_class):
|
||||||
id = "UC1"
|
id = "UC1"
|
||||||
|
|
||||||
# Rule class must have an name
|
# Rule class must have a name
|
||||||
expected_msg = "User-defined rule class 'MyRuleClass' must have a 'name' attribute"
|
expected_msg = "User-defined rule class 'MyRuleClass' must have a 'name' attribute"
|
||||||
with self.assertRaisesMessage(UserRuleError, expected_msg):
|
with self.assertRaisesMessage(UserRuleError, expected_msg):
|
||||||
assert_valid_rule_class(MyRuleClass)
|
assert_valid_rule_class(MyRuleClass)
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue