From 1fcd2d1f0a248c3dbf94bc4119d2ac00d8ec1fba Mon Sep 17 00:00:00 2001 From: Samuele Maci Date: Sat, 13 Jul 2024 13:41:11 +0100 Subject: [PATCH 1/3] Fix pre-commit on altered files in #213 --- .github/workflows/bump_external_releases.py | 7 +------ language_formatters_pre_commit_hooks/pretty_format_java.py | 3 ++- tests/pretty_format_java_test.py | 4 +--- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/bump_external_releases.py b/.github/workflows/bump_external_releases.py index 42d744c..5ba808d 100644 --- a/.github/workflows/bump_external_releases.py +++ b/.github/workflows/bump_external_releases.py @@ -75,12 +75,7 @@ def bump_palantir_java_formatter(): ) -bump_functions = ( - bump_ktfmt, - bump_ktlint, - bump_google_java_formatter, - bump_palantir_java_formatter -) +bump_functions = (bump_ktfmt, bump_ktlint, bump_google_java_formatter, bump_palantir_java_formatter) if __name__ == "__main__": something_is_bumped = False diff --git a/language_formatters_pre_commit_hooks/pretty_format_java.py b/language_formatters_pre_commit_hooks/pretty_format_java.py index 6020c5a..5b9bad0 100644 --- a/language_formatters_pre_commit_hooks/pretty_format_java.py +++ b/language_formatters_pre_commit_hooks/pretty_format_java.py @@ -81,6 +81,7 @@ def get_urls(_version: str) -> typing.List[str]: ), ) + @java_required def pretty_format_java(argv: typing.Optional[typing.List[str]] = None) -> int: parser = argparse.ArgumentParser() @@ -223,7 +224,7 @@ def format_palantir(args): ] if args.aosp: # pragma: no cover cmd_args.append("--aosp") - if args.autofix: # pragma: no cover + if args.autofix: # pragma: no cover cmd_args.append("--replace") else: cmd_args.append("--dry-run") diff --git a/tests/pretty_format_java_test.py b/tests/pretty_format_java_test.py index aa24695..4347e0e 100644 --- a/tests/pretty_format_java_test.py +++ b/tests/pretty_format_java_test.py @@ -46,9 +46,7 @@ def test__download_google_java_formatter_jar(ensure_download_possible, version): @pytest.mark.parametrize( "version", - ( - _get_default_version("palantir"), - ), + (_get_default_version("palantir"),), ) @pytest.mark.integration def test__download_palantir_java_formatter_jar(ensure_download_possible, version): # noqa: F811 From 574048eb0a4af8f2c368d51f6cdb0c8c34cd5f1d Mon Sep 17 00:00:00 2001 From: Samuele Maci Date: Sat, 13 Jul 2024 13:37:41 +0100 Subject: [PATCH 2/3] Bump python-version in pre-commit configs --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8558b5d..b350db2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,5 @@ default_language_version: - python: python3.10 + python: python3.12 repos: - repo: https://github.com/pre-commit/pre-commit From 80f56a51a7f126fc0c7d4dcf883e52b066712bd6 Mon Sep 17 00:00:00 2001 From: Samuele Maci Date: Sat, 13 Jul 2024 13:43:01 +0100 Subject: [PATCH 3/3] Bump pre-commit hooks --- .pre-commit-config.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b350db2..93a53f9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,11 +3,11 @@ default_language_version: repos: - repo: https://github.com/pre-commit/pre-commit - rev: v3.7.0 + rev: v3.7.1 hooks: - id: validate_manifest - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v4.6.0 hooks: - id: check-added-large-files - id: check-docstring-first @@ -27,7 +27,7 @@ repos: exclude: ^test-data/.*$ - id: fix-encoding-pragma - repo: https://github.com/asottile/reorder_python_imports - rev: v3.12.0 + rev: v3.13.0 hooks: - id: reorder-python-imports args: @@ -38,23 +38,23 @@ repos: - --remove-import - from __future__ import unicode_literals - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks - rev: v2.12.0 + rev: v2.13.0 hooks: - id: pretty-format-yaml exclude: ^test-data/.*$ args: - --autofix - repo: https://github.com/ambv/black - rev: 24.3.0 + rev: 24.4.2 hooks: - id: black args: [--config, .black.toml] - repo: https://github.com/PyCQA/flake8 - rev: 7.0.0 + rev: 7.1.0 hooks: - id: flake8 - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.9.0 + rev: v1.10.1 hooks: - id: mypy exclude: ^(\.github/workflows/bump_external_releases\.py)$ @@ -62,7 +62,7 @@ repos: - types-requests - types-setuptools - repo: https://github.com/PyCQA/bandit - rev: 1.7.8 + rev: 1.7.9 hooks: - id: bandit exclude: ^tests/.*\.py$