From 3a9a8c4b53881e35b5530f78b8526a3157bbcc56 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Tue, 13 Aug 2024 19:10:04 -0700 Subject: [PATCH] CI: `isort` until ruff fix --- .pre-commit-config.yaml | 16 +++++++++++++--- pyproject.toml | 6 +----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 921716b1..97d66748 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -71,18 +71,28 @@ repos: # hooks: # - id: clang-format -# Python: Ruff linter +# Python: Ruff linter & formatter # https://docs.astral.sh/ruff/ - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.5.6 hooks: - # Run the linter. + # Run the linter - id: ruff args: [--fix, --exit-non-zero-on-fix] types_or: [python, jupyter] - # Run the formatter. + # Run the formatter - id: ruff-format +# Sorts Python imports according to PEP8 +# https://www.python.org/dev/peps/pep-0008/#imports +# Needed until https://github.com/astral-sh/ruff/issues/12872 is fixed +- repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort + name: isort (python) + args: ["--profile", "black", "--filter-files"] + # Jupyter Notebooks: clean up all cell outputs - repo: https://github.com/roy-ht/pre-commit-jupyter rev: v1.2.1 diff --git a/pyproject.toml b/pyproject.toml index 3c8601cd..38ddd6e8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,16 +7,12 @@ requires = [ ] build-backend = "setuptools.build_meta" -[tool.flake8] -#ignore = ['E231', 'E241'] -select = ['F', 'B'] - [tool.ruff.format] docstring-code-format = true [tool.ruff.lint] -ignore = ["E402", "E501"] select = ["E", "F", "I"] +ignore = ["E402", "E501"] [tool.ruff.lint.isort] known-first-party = ["amrex"]