From 22bf1d660faf73c48f25b944b82dafae84b2589f Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Mon, 25 Dec 2023 21:18:50 +0100 Subject: [PATCH] Apply Repo-Review suggestions --- codespell_lib/__init__.py | 2 +- codespell_lib/_codespell.py | 4 +++- pyproject.toml | 23 +++++++++++++++-------- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/codespell_lib/__init__.py b/codespell_lib/__init__.py index 4484dbd4fe..c5dc784cb8 100644 --- a/codespell_lib/__init__.py +++ b/codespell_lib/__init__.py @@ -1,4 +1,4 @@ from ._codespell import _script_main, main -from ._version import __version__ # type: ignore +from ._version import __version__ # type: ignore[import-not-found] __all__ = ["_script_main", "main", "__version__"] diff --git a/codespell_lib/_codespell.py b/codespell_lib/_codespell.py index 6e3662a8b7..4d6d1371d9 100644 --- a/codespell_lib/_codespell.py +++ b/codespell_lib/_codespell.py @@ -26,7 +26,9 @@ from typing import Any, Dict, List, Match, Optional, Pattern, Sequence, Set, Tuple # autogenerated by setuptools_scm -from ._version import __version__ as VERSION # type: ignore # noqa: N812 +from ._version import ( # type: ignore[import-not-found] + __version__ as VERSION, # noqa: N812 +) word_regex_def = r"[\w\-'’]+" # While we want to treat characters like ( or " as okay for a starting break, diff --git a/pyproject.toml b/pyproject.toml index 7fc220611d..561d1777c2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -92,15 +92,24 @@ codespell_lib = [ [tool.mypy] pretty = true -show_error_codes = true +hide_error_codes = false strict = true warn_unused_ignores = false +enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"] [tool.pytest.ini_options] -addopts = "--cov=codespell_lib -rs --cov-report= --tb=short --junit-xml=junit-results.xml" +minversion = "6" +testpaths = ["codespell_lib/tests"] +log_cli_level = "INFO" +xfail_strict = true +addopts = ["--cov=codespell_lib", "-rs", "--strict-config", "--strict-markers", "--cov-report=", "--tb=short", "--junit-xml=junit-results.xml"] +filterwarnings = ["error"] [tool.ruff] -extend-ignore = [ +line-length = 88 + +[tool.ruff.lint] +ignore = [ "ANN101", "B904", "PLW2901", @@ -120,7 +129,6 @@ extend-ignore = [ "ISC001", "ISC002", ] -line-length = 88 select = [ "A", "ANN", @@ -141,17 +149,16 @@ select = [ "W", "YTT", ] -target-version = "py37" -[tool.ruff.mccabe] +[tool.ruff.lint.mccabe] max-complexity = 45 -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "codespell_lib/_codespell.py" = ["A003"] "codespell_lib/tests/test_*" = ["S101"] "codespell_lib/tests/test_basic.py" = ["ANN401", "N802"] -[tool.ruff.pylint] +[tool.ruff.lint.pylint] allow-magic-value-types = ["bytes", "int", "str",] max-args = 12 max-branches = 49