From 38f03b2f248ee822ce59d70fc231791253f045b3 Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Sun, 1 Oct 2023 15:04:32 +0200 Subject: [PATCH] precommit: enable codespell (#35) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 7 +++++++ pyproject.toml | 11 ++++++++++- setup.py | 4 ++-- src/deprecate/deprecation.py | 6 +++--- src/deprecate/utils.py | 2 +- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d3bb10b..51cf8a4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,6 +29,13 @@ repos: args: ["--py37-plus"] name: Upgrade code + - repo: https://github.com/codespell-project/codespell + rev: v2.2.5 + hooks: + - id: codespell + additional_dependencies: [tomli] + #args: ["--write-changes"] # uncomment if you want to get automatic fixing + #- repo: https://github.com/PyCQA/docformatter # rev: v1.5.1 # hooks: diff --git a/pyproject.toml b/pyproject.toml index f31e7ca..6d27f0f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,12 +40,21 @@ exclude_lines = [ "pragma: no cover", "pass", ] - [tool.coverage.run] parallel = true relative_files = true +[tool.codespell] +#skip = '*.py' +quiet-level = 3 +# comma separated list of words; waiting for: +# https://github.com/codespell-project/codespell/issues/2839#issuecomment-1731601603 +# also adding links until they ignored by its: nature +# https://github.com/codespell-project/codespell/issues/2243#issuecomment-1732019960 +#ignore-words-list = "" + + [tool.black] # https://github.com/psf/black line-length = 120 diff --git a/setup.py b/setup.py index b913034..e298999 100755 --- a/setup.py +++ b/setup.py @@ -22,8 +22,8 @@ def _load_py_module(fname: str, pkg: str = "deprecate"): def _load_long_description(path_dir: str, version: str) -> str: path_readme = os.path.join(path_dir, "README.md") - with open(path_readme, encoding="utf-8") as fo: - text = fo.read() + with open(path_readme, encoding="utf-8") as fopen: + text = fopen.read() # codecov badge text = text.replace("/branch/main/graph/badge.svg", f"/release/{version}/graph/badge.svg") # replace github badges for release ones diff --git a/src/deprecate/deprecation.py b/src/deprecate/deprecation.py index 5c81f9f..aa1ff67 100644 --- a/src/deprecate/deprecation.py +++ b/src/deprecate/deprecation.py @@ -9,17 +9,17 @@ from deprecate.utils import get_func_arguments_types_defaults -#: Default template warning message fot redirecting callable +#: Default template warning message for redirecting callable TEMPLATE_WARNING_CALLABLE = ( "The `%(source_name)s` was deprecated since v%(deprecated_in)s in favor of `%(target_path)s`." " It will be removed in v%(remove_in)s." ) -#: Default template warning message for chnaging argument mapping +#: Default template warning message for changing argument mapping TEMPLATE_WARNING_ARGUMENTS = ( "The `%(source_name)s` uses deprecated arguments: %(argument_map)s." " They were deprecated since v%(deprecated_in)s and will be removed in v%(remove_in)s." ) -#: Tempalte for mapping from old to new examples +#: Template for mapping from old to new examples TEMPLATE_ARGUMENT_MAPPING = "`%(old_arg)s` -> `%(new_arg)s`" #: Default template warning message for no target func/method TEMPLATE_WARNING_NO_TARGET = ( diff --git a/src/deprecate/utils.py b/src/deprecate/utils.py index 6f057a5..b42023e 100644 --- a/src/deprecate/utils.py +++ b/src/deprecate/utils.py @@ -15,7 +15,7 @@ def get_func_arguments_types_defaults(func: Callable) -> List[Tuple[str, Tuple, func: a function to be xeamined Returns: - sequence of details for each position/keyward argument + sequence of details for each position/keyword argument Example: >>> get_func_arguments_types_defaults(get_func_arguments_types_defaults)