diff --git a/.commit-check.yml b/.commit-check.yml index 10f8d39..ad339d0 100644 --- a/.commit-check.yml +++ b/.commit-check.yml @@ -14,7 +14,7 @@ checks: suggest: run command `git checkout -b type/branch_name` - check: author_name - regex: ^[A-Za-z ,.\'-]+$|.*(\[bot]) + regex: ^[A-Za-zÀ-ÖØ-öø-ÿ\u0100-\u017F\u0180-\u024F ,.\'-]+$|.*(\[bot]) error: The committer name seems invalid suggest: run command `git config user.name "Your Name"` diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e1d96d8..2953fc4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,23 +17,23 @@ repos: - id: requirements-txt-fixer - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.9.3 + rev: v0.9.6 hooks: # Run the linter. - id: ruff args: [ --fix ] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.14.1 + rev: v1.15.0 hooks: - id: mypy additional_dependencies: [types-PyYAML] exclude: ^testing/resources/ - repo: https://github.com/codespell-project/codespell - rev: v2.4.0 + rev: v2.4.1 hooks: - id: codespell - repo: https://github.com/commit-check/commit-check - rev: v0.9.2 + rev: v0.9.3 hooks: - id: check-message # - id: check-branch # uncomment if you need. diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..9bfb5c2 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,17 @@ +# Read the Docs configuration file for Sphinx projects +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "3.12" + +sphinx: + builder: "dirhtml" + configuration: docs/conf.py + +# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html +python: + install: + - requirements: docs/requirements.txt diff --git a/commit_check/__init__.py b/commit_check/__init__.py index 61de524..521f68f 100644 --- a/commit_check/__init__.py +++ b/commit_check/__init__.py @@ -32,7 +32,7 @@ }, { 'check': 'author_name', - 'regex': r'^[A-Za-z ,.\'-]+$|.*(\[bot])', + 'regex': r'^[A-Za-zÀ-ÖØ-öø-ÿ\u0100-\u017F\u0180-\u024F ,.\'-]+$|.*(\[bot])', 'error': 'The committer name seems invalid', 'suggest': 'run command `git config user.name "Your Name"`', }, diff --git a/docs/requirements.txt b/docs/requirements.txt index d078f24..af718d9 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1 +1,3 @@ + +. sphinx-immaterial diff --git a/tests/author_test.py b/tests/author_test.py index 21f637d..8936223 100644 --- a/tests/author_test.py +++ b/tests/author_test.py @@ -9,6 +9,7 @@ class TestAuthor: class TestAuthorName: # used by get_commit_info mock fake_author_value_an = "fake_author_name" + fake_accented_author_value_an = "fáké_áúthór_námé" def test_check_author(self, mocker): # Must call get_commit_info, re.match. @@ -29,6 +30,25 @@ def test_check_author(self, mocker): assert m_get_commit_info.call_count == 1 assert m_re_match.call_count == 1 + def test_check_author_with_accented_letters(self, mocker): + # Must call get_commit_info, re.match. + checks = [{ + "check": "author_name", + "regex": "dummy_regex" + }] + m_get_commit_info = mocker.patch( + f"{LOCATION}.get_commit_info", + return_value=self.fake_accented_author_value_an + ) + m_re_match = mocker.patch( + "re.match", + return_value="fake_rematch_resp" + ) + retval = check_author(checks, "author_name") + assert retval == PASS + assert m_get_commit_info.call_count == 1 + assert m_re_match.call_count == 1 + def test_check_author_with_empty_checks(self, mocker): # Must NOT call get_commit_info, re.match. with `checks` param with length 0. checks = []