From d189b19bb2aeb49cfd052d02c9e4cd76b4ebc162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Thu, 25 Apr 2024 19:31:23 +0200 Subject: [PATCH] ci: incorporate codespell Use file-wide ignores for now until inline ignores are supported, see https://github.com/codespell-project/codespell/issues/3387. --- .pre-commit-config.yaml | 7 ++++++- docs/admin/install/docker.rst | 2 +- docs/changes.rst | 6 +++--- docs/formats/android.rst | 2 +- pyproject.toml | 5 +++-- weblate/checks/format.py | 2 +- weblate/utils/tests/test_validators.py | 2 +- 7 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f2e197e258fa..aa399421eddb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -84,7 +84,12 @@ repos: additional_dependencies: - '@biomejs/biome@1.7.1' files: \.js$ - +- repo: https://github.com/codespell-project/codespell + rev: v2.2.6 + hooks: + - id: codespell + additional_dependencies: + - tomli exclude: ^.*\.(csv|svg|wsdl(\.[^.]*)?)|weblate/trans/tests/data/memory-broken\.json|weblate/templates/browserconfig\.xml|weblate/templates/configuration/custom\.css|weblate/trans/tests/data/cs-CZ\.rc|weblate/static/vendor/.*|docs/make\.bat|weblate/templates/addons/js/weblate\.js$ ci: diff --git a/docs/admin/install/docker.rst b/docs/admin/install/docker.rst index caf994ef4a25..c451c1713bc6 100644 --- a/docs/admin/install/docker.rst +++ b/docs/admin/install/docker.rst @@ -1363,7 +1363,7 @@ Other authentication settings Minimal password score as evaluated by the `zxcvbn `_ password strength estimator. - Defaults to 3, set to 0 to disable strenght checking. + Defaults to 3, set to 0 to disable strength checking. PostgreSQL database setup diff --git a/docs/changes.rst b/docs/changes.rst index 8b539bdbf590..e8c9c9e83170 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -24,7 +24,7 @@ Not yet released. * Allow editing strings when the source is marked for editing. * Updates of last updated timestamp of a string. * Fixed project and site wide installation of :ref:`addon-weblate.git.squash` and :ref:`addon-weblate.discovery.discovery` add-ons. -* Graceful handling of locking erors in the :ref:`api`. +* Graceful handling of locking errors in the :ref:`api`. **Compatibility** @@ -57,7 +57,7 @@ Released on April 20th 2024. **Improvements** -* Docker container now validates user password strenght by default, see :envvar:`WEBLATE_MIN_PASSWORD_SCORE`. +* Docker container now validates user password strength by default, see :envvar:`WEBLATE_MIN_PASSWORD_SCORE`. * Improved error reporting in :ref:`machine-translation-setup`. * :ref:`check-max-size` better displays rendered text. * Admins can now specify username and full name when :ref:`invite-user`. @@ -439,7 +439,7 @@ Released on September 10th 2023. * Source strings and state display for converted formats. * Block :ref:`component-edit_template` on formats which do not support it. * :ref:`check-reused` is no longer triggered for blank strings. -* Performace issues while browsing some categories. +* Performance issues while browsing some categories. * Fixed GitHub Team and Organization authentication in Docker container. * GitLab merge requests when using a customized SSH port. diff --git a/docs/formats/android.rst b/docs/formats/android.rst index 46ad719cb2f7..e26352c63420 100644 --- a/docs/formats/android.rst +++ b/docs/formats/android.rst @@ -15,7 +15,7 @@ stored in a different location from the other files -- :file:`res/values/strings Weblate does following escaping of strings: * If a strings is valid XML, it is inserted as XML to translation. -* ``?`` and ``@`` are escaped with a ``\\`` at the beginning of the string to avoid intepreting them as style or resource references. +* ``?`` and ``@`` are escaped with a ``\\`` at the beginning of the string to avoid interpreting them as style or resource references. * In case string contains multiple spaces, it is quoted with double quotes (``"``). * Newlines are escaped as ``\\n``, but the actual newline is kept for readability as well. diff --git a/pyproject.toml b/pyproject.toml index 5d67964c8886..b5b8ccfa963d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -197,7 +197,8 @@ target-version = ['py310'] [tool.codespell] count = true -skip = '*.po,*.pot,*.json,*.tmx,*.tbx,*.csv,yarn.lock,known_hosts,*/vendor/*' +# TODO: the per-file ignores should use inlines once supported by codespell +skip = '*.po,*.pot,*.json,*.tmx,*.tbx,*.csv,yarn.lock,known_hosts,*/vendor/*,weblate/checks/tests/test_chars_checks.py,weblate/checks/tests/test_fluent_checks.py,weblate/checks/tests/test_format_checks.py,weblate/checks/tests/test_duplicate_checks.py,weblate/checks/tests/test_icu_checks.py,weblate/machinery/aws.py,weblate/machinery/baidu.py,weblate/machinery/apertium.py,weblate/machinery/saptranslationhub.py,weblate/screenshots/views.py,weblate/trans/specialchars.py,weblate/checks/data.py,weblate/machinery/alibaba.py,weblate/formats/base.py,weblate/formats/tests/test_multi.py,weblate/vcs/gpg.py,scripts/yarn/yarn.lock,weblate/trans/tests/data/known_hosts,scripts/generate-specialchars,docs/user/checks.rst' [tool.django-stubs] django_settings_module = "weblate.settings_example" @@ -344,7 +345,7 @@ ignore = [ "D100", # TODO: Missing docstring in public module "D101", # TODO: Missing docstring in public class "D102", # TODO: Missing docstring in public method - "D103", # TODO: Missing docstring in public functio + "D103", # TODO: Missing docstring in public function "D104", # TODO: Missing docstring in public package "D105", # TODO: Missing docstring in magic method "D106", # TODO: Missing docstring in public nested class diff --git a/weblate/checks/format.py b/weblate/checks/format.py index 4c3151b00b6a..ec290c515f15 100644 --- a/weblate/checks/format.py +++ b/weblate/checks/format.py @@ -161,7 +161,7 @@ (?:\d+)? # width (?:\.\d+)? # precision (?P - ((? None: def test_invalid_format(self) -> None: with self.assertRaises(ValidationError): - validate_editor("editor://open/?file={{ fle }}&line={{ line }}") + validate_editor("editor://open/?file={{ fl }}&line={{ line }}") def test_no_scheme(self) -> None: with self.assertRaises(ValidationError):