diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index bb8b7c3..26859e7 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -16,11 +16,11 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v3 with: - python-version: '3.8' + python-version: '3.11' - name: Installation (deps and package) run: | - pip install . pre-commit mypy==0.910 -r tests/requirements.txt + pip install . pre-commit mypy==1.11.2 -r tests/requirements.txt - name: run linters run: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e42d74e..55a3748 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: f71fa2c1f9cf5cb705f73dffe4b21f7c61470ba9 # frozen: v4.4.0 + rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0 hooks: - id: check-yaml - id: check-toml @@ -23,22 +23,27 @@ repos: hooks: - id: absolufy-imports - repo: https://github.com/PyCQA/isort - rev: dbf82f2dd09ae41d9355bcd7ab69187a19e6bf2f # frozen: 5.12.0 + rev: c235f5e450b4b84e58d114ed4c589cbf454175a3 # frozen: 5.13.2 hooks: - id: isort - repo: https://github.com/psf/black - rev: 193ee766ca496871f93621d6b58d57a6564ff81b # frozen: 23.7.0 + rev: b965c2a5026f8ba399283ba3e01898b012853c79 # frozen: 24.8.0 hooks: - id: black -- repo: https://github.com/myint/docformatter - rev: dfefe062799848234b4cd60b04aa633c0608025e # frozen: v1.7.5 - hooks: - - id: docformatter +# Disable docformatter until https://github.com/PyCQA/docformatter/pull/287 is merged +#- repo: https://github.com/PyCQA/docformatter +# rev: dfefe062799848234b4cd60b04aa633c0608025e # frozen: v1.7.5 +# hooks: +# - id: docformatter - repo: https://github.com/PyCQA/flake8 - rev: 10f4af6dbcf93456ba7df762278ae61ba3120dc6 # frozen: 6.1.0 + rev: e43806be3607110919eff72939fda031776e885a # frozen: 7.1.1 hooks: - id: flake8 additional_dependencies: - flake8-bugbear - flake8-builtins - flake8-comprehensions +- repo: https://github.com/pre-commit/pre-commit + rev: dbccd57db0e9cf993ea909e929eea97f6e4389ea # frozen: v4.0.0 + hooks: + - id: validate_manifest diff --git a/pyproject.toml b/pyproject.toml index 88e002a..c3997f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -93,7 +93,7 @@ description = run mypy basepython = python3.8 deps = -r tests/requirements.txt - mypy==0.910 + mypy==1.11.2 commands = mypy {posargs:src/ tests/} @@ -168,8 +168,3 @@ no_implicit_optional = true [[tool.mypy.overrides]] module = "tests.*" disallow_untyped_defs = false - -[[tool.mypy.overrides]] -# This matches `fuzzer/fuzz.py`. -module = "fuzz" -ignore_errors = true diff --git a/src/mdformat/_cli.py b/src/mdformat/_cli.py index 39491cd..9f7cb52 100644 --- a/src/mdformat/_cli.py +++ b/src/mdformat/_cli.py @@ -128,9 +128,9 @@ def make_arg_parser( plugin_versions_str = get_plugin_versions_str(parser_extensions, codeformatters) parser = argparse.ArgumentParser( description="CommonMark compliant Markdown formatter", - epilog=f"Installed plugins: {plugin_versions_str}" - if plugin_versions_str - else None, + epilog=( + f"Installed plugins: {plugin_versions_str}" if plugin_versions_str else None + ), ) parser.add_argument("paths", nargs="*", help="files to format") parser.add_argument( @@ -254,7 +254,7 @@ def log_handler_applied( def get_package_name(obj: object) -> str: # Packages and modules should have `__package__` if hasattr(obj, "__package__"): - package_name = obj.__package__ # type: ignore[attr-defined] + package_name = obj.__package__ else: # class or function module_name = obj.__module__ package_name = module_name.split(".", maxsplit=1)[0] diff --git a/src/mdformat/codepoints/_unicode_punctuation.py b/src/mdformat/codepoints/_unicode_punctuation.py index c0cc768..1a72919 100644 --- a/src/mdformat/codepoints/_unicode_punctuation.py +++ b/src/mdformat/codepoints/_unicode_punctuation.py @@ -2,6 +2,7 @@ Run this module to generate and print an up-to-date set of characters. """ + UNICODE_PUNCTUATION = frozenset( ( "!", diff --git a/src/mdformat/codepoints/_unicode_whitespace.py b/src/mdformat/codepoints/_unicode_whitespace.py index adce7cf..469aa58 100644 --- a/src/mdformat/codepoints/_unicode_whitespace.py +++ b/src/mdformat/codepoints/_unicode_whitespace.py @@ -2,6 +2,7 @@ Run this module to generate and print an up-to-date set of characters. """ + UNICODE_WHITESPACE = frozenset( ( "\t", diff --git a/tests/test_commonmark_spec.py b/tests/test_commonmark_spec.py index bb477c3..e8e52b9 100644 --- a/tests/test_commonmark_spec.py +++ b/tests/test_commonmark_spec.py @@ -101,9 +101,11 @@ "entry", ALL_CASES, ids=[ - c.values[0]["name"] # type: ignore[index] - if isinstance(c, ParameterSet) - else c["name"] + ( + c.values[0]["name"] # type: ignore[index] + if isinstance(c, ParameterSet) + else c["name"] + ) for c in ALL_CASES ], ) diff --git a/tests/test_for_profiler.py b/tests/test_for_profiler.py index d160562..806e848 100644 --- a/tests/test_for_profiler.py +++ b/tests/test_for_profiler.py @@ -7,6 +7,7 @@ - `tox -e profile` - `firefox .tox/prof/combined.svg` """ + from pathlib import Path from mdformat._cli import run