From e696a931e95ad70fa9884d5e05b46b8fd88195db Mon Sep 17 00:00:00 2001 From: Samuele Maci Date: Wed, 29 Jun 2022 09:57:56 +0100 Subject: [PATCH 1/2] Bump pre-commit hooks: update black and bandit exclusions Bump all the pre-commit hooks used. Contextually we need to * update black config to assume only Python 3 (due to latest black does not support Python2.7) The tool does not really support Python 2.7 so it is safe * update bandit exclusions (needed due to the update of bandit pre-commit hook) --- .black.toml | 2 +- .github/workflows/bump_external_releases.py | 2 +- .pre-commit-config.yaml | 14 +++++++------- language_formatters_pre_commit_hooks/utils.py | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.black.toml b/.black.toml index 6363dbf..ee37b0a 100644 --- a/.black.toml +++ b/.black.toml @@ -1,4 +1,4 @@ [tool.black] include = '\.pyi?$' line-length = 141 -target-version = ['py27'] +target-version = ['py36'] diff --git a/.github/workflows/bump_external_releases.py b/.github/workflows/bump_external_releases.py index d4a155f..7ccdff3 100644 --- a/.github/workflows/bump_external_releases.py +++ b/.github/workflows/bump_external_releases.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- import json -import subprocess # nosec: disable=B603 +import subprocess # nosec B404 B603 import sys import traceback from pathlib import Path diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c5106d0..2b65b29 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: v2.14.0 + rev: v2.19.0 hooks: - id: validate_manifest - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.0.1 + rev: v4.3.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: v2.6.0 + rev: v3.1.0 hooks: - id: reorder-python-imports args: @@ -38,14 +38,14 @@ repos: - --remove-import - from __future__ import unicode_literals - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks - rev: v2.1.0 + rev: v2.3.0 hooks: - id: pretty-format-yaml exclude: ^test-data/.*$ args: - --autofix - repo: https://github.com/ambv/black - rev: 21.7b0 + rev: 22.6.0 hooks: - id: black args: [--config, .black.toml] @@ -54,7 +54,7 @@ repos: hooks: - id: flake8 - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.910 + rev: v0.961 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.0 + rev: 1.7.4 hooks: - id: bandit exclude: ^tests/.*\.py$ diff --git a/language_formatters_pre_commit_hooks/utils.py b/language_formatters_pre_commit_hooks/utils.py index 1a2554d..caf4e8d 100644 --- a/language_formatters_pre_commit_hooks/utils.py +++ b/language_formatters_pre_commit_hooks/utils.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import os import shutil -import subprocess # nosec: disable=B603 +import subprocess # nosec B404 B603 import sys import tempfile import typing From 6fc902c92d8b69239a3a280b877ec92fcbc2489b Mon Sep 17 00:00:00 2001 From: Samuele Maci Date: Wed, 29 Jun 2022 10:11:32 +0100 Subject: [PATCH 2/2] Enable Python 3.10 tests and run pre-commits with Python 3.10 --- .github/workflows/build.yaml | 4 ++-- .pre-commit-config.yaml | 2 +- tox.ini | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index bbb77aa..319686a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -18,7 +18,7 @@ jobs: golang_version: [1.16.4] java_version: ['15', '16'] - python_version: [3.6, 3.7, 3.8, 3.9] + python_version: ['3.6', '3.7', '3.8', '3.9', '3.10'] rust_version: [stable] env: @@ -72,7 +72,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: '3.10' - name: Install Python dependencies run: pip install tox - name: Run Tox diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2b65b29..3fdba07 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,5 +1,5 @@ default_language_version: - python: python3.9 + python: python3.10 repos: - repo: https://github.com/pre-commit/pre-commit diff --git a/tox.ini b/tox.ini index f99b12d..48ff16c 100644 --- a/tox.ini +++ b/tox.ini @@ -23,7 +23,7 @@ commands = coverage report [testenv:pre-commit] -basepython = python3.9 +basepython = python3.10 setenv = SKIP=mypy commands =