1
0
Fork 0

Merging upstream version 0.17.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-13 06:06:00 +01:00
parent c90d4ccbc4
commit 435cb3a48d
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
128 changed files with 72 additions and 100 deletions

View file

@ -3,4 +3,4 @@ fail_under = 97
[run]
branch = true
omit=*dist-packages*,*site-packages*,gitlint/tests/*,.venv/*,*virtualenv*
omit=*dist-packages*,*site-packages*,gitlint-core/gitlint/tests/*,.venv/*,*virtualenv*

View file

@ -109,13 +109,13 @@ jobs:
run: gitlint --version
- 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\*)
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)
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
- name: Tests (all - continue-on-error:true)
@ -127,10 +127,10 @@ jobs:
continue-on-error: true # Known to fail at this point
- name: PEP8
run: flake8 gitlint qa examples
run: flake8 gitlint-core qa examples
- 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.
- name: Re-add git version control to code

View file

@ -1,6 +1,7 @@
- id: gitlint
name: gitlint
language: python
additional_dependencies: ["./gitlint-core[trusted-deps]"]
entry: gitlint
args: [--staged, --msg-filename]
stages: [commit-msg]

View file

@ -1,5 +1,11 @@
# 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) ##
Contributors:

View file

@ -3,5 +3,5 @@ include LICENSE
exclude Vagrantfile
exclude *.yml *.sh *.txt
recursive-exclude examples *
recursive-exclude gitlint/tests *
recursive-exclude qa *
recursive-exclude gitlint-core *
recursive-exclude qa *

View file

@ -1 +1 @@
mkdocs==1.2.2
mkdocs==1.2.3

View file

@ -108,7 +108,7 @@ ignore-merge-commits=false
# 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.
files=gitlint/rules.py,README.md
files=gitlint-core/gitlint/rules.py,README.md
[body-match-regex]
# python-style regex that the commit-msg body must match.

View file

@ -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:
- [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
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
@ -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
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.
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).
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).
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!

View file

@ -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.
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
use gitlint's *ignore* rules.

View file

@ -374,7 +374,7 @@ class ReleaseConfigurationRule(ConfigurationRule):
```
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.
@ -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,
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.
### Rule class requirements

View file

@ -55,4 +55,4 @@ ignore-merge-commits=false
# 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.
files=gitlint/rules.py,README.md
files=gitlint-core/gitlint/rules.py,README.md

1
gitlint-core/LICENSE Symbolic link
View file

@ -0,0 +1 @@
../LICENSE

3
gitlint-core/MANIFEST.in Normal file
View file

@ -0,0 +1,3 @@
include README.md
include LICENSE
recursive-exclude gitlint/tests *

1
gitlint-core/README.md Symbolic link
View file

@ -0,0 +1 @@
../README.md

View file

@ -0,0 +1 @@
__version__ = "0.17.0"

View file

@ -428,7 +428,7 @@ class LintConfigBuilder:
f"'{config_option}' is an invalid configuration option. Use '<rule>.<option>=<value>'") from e
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):
raise LintConfigError(f"Invalid file path: {filename}")
self._config_path = os.path.realpath(filename)

View file

@ -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 :-)
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)):
# https://stackoverflow.com/questions/394230/how-to-detect-the-os-from-a-bash-script
if [ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ] || [ "$OSTYPE" = "win32" ]; then

View file

@ -45,7 +45,7 @@
# extra-path=examples/
# 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]
# line-length=50
@ -82,7 +82,7 @@
# 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.
# files=gitlint/rules.py,README.md
# files=gitlint-core/gitlint/rules.py,README.md
# [body-match-regex]
# python-style regex that the commit-msg body must match.

View file

@ -367,7 +367,7 @@ class GitContext(PropertyCache):
def from_local_repository(repository_path, refspec=None, commit_hash=None):
""" Retrieves the git context from a local git repository.
: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`)
"""

View file

@ -86,7 +86,7 @@ class BoolOption(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

View file

@ -1,7 +1,7 @@
"""
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.
"""

View file

@ -33,7 +33,7 @@ class BaseTestCase(unittest.TestCase):
logging.getLogger('gitlint').setLevel(logging.DEBUG)
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
# in gitlint.cli that normally takes care of this
logging.getLogger('gitlint').propagate = False

View file

@ -19,7 +19,7 @@ class RuleCollectionTests(BaseTestCase):
self.assertEqual(len(collection), 1)
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_attr2, expected.my_attr2)

View file

@ -170,7 +170,7 @@ class UserRuleTests(BaseTestCase):
class MyRuleClass(parent_class):
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"
with self.assertRaisesMessage(UserRuleError, expected_msg):
assert_valid_rule_class(MyRuleClass)

Some files were not shown because too many files have changed in this diff Show more