From a33c03cf0926b2778c7c21d7d2fde07dbb85145f Mon Sep 17 00:00:00 2001 From: Andrew Grimberg Date: Tue, 4 Jun 2024 06:35:21 -0700 Subject: [PATCH] CI: Swap in ruff for black and flake8 * ruff runs significantly faster than black and flake8 and is a single tool instead of two separate tools * Fix the bandit configuration to properly exclude all test files Signed-off-by: Andrew Grimberg Change-Id: I1d5d321f35cb56f669ec1b02097c1e7f2e21f94f --- .pre-commit-config.yaml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6a5ec0c..8eba625 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,24 +16,22 @@ repos: hooks: - id: gitlint - - repo: https://github.com/ambv/black - rev: 23.3.0 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: fc609d3ce5e38f1d32423050196bf0ce4ecc59c1 # frozen: v0.4.5 hooks: - - id: black + - id: ruff + files: ^(docs)/.+\.py$ + args: [--fix, --exit-non-zero-on-fix] + - id: ruff-format + files: ^(docs)/.+\.py$ - - repo: https://github.com/PyCQA/flake8 - rev: 6.0.0 - hooks: - - id: flake8 - args: ["--max-line-length=120"] - additional_dependencies: [Flake8-pyproject] - repo: https://github.com/pycqa/bandit rev: 1.7.5 hooks: - id: bandit # Bandit does not need to run on test code - exclude: tests/* + exclude: tests/.* - repo: https://github.com/pycqa/pydocstyle rev: 6.3.0 -- 2.16.6