From 0db51663902f00f9948df8d223aca64c69993fb2 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Thu, 14 Dec 2023 01:04:54 +0100 Subject: [PATCH] =?UTF-8?q?MNT:=20flake8/black/isort=20=E2=86=92=20ruff?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/contrib.yml | 12 ++++++------ .pre-commit-config.yaml | 11 ++++------- pyproject.toml | 27 ++++++++++----------------- wrapper/pyproject.toml | 7 ++----- 4 files changed, 22 insertions(+), 35 deletions(-) diff --git a/.github/workflows/contrib.yml b/.github/workflows/contrib.yml index dd3a565a4..23d96669b 100644 --- a/.github/workflows/contrib.yml +++ b/.github/workflows/contrib.yml @@ -37,16 +37,16 @@ jobs: python-version: ${{ matrix.python-version }} - name: Display Python version run: python -c "import sys; print(sys.version)" - - name: Install black/isort - run: python -m pip install black isort[colors] + - name: Install ruff + run: python -m pip install ruff[colors] - name: Check fMRIPrep run: | - python -m black --diff --color --check fmriprep - python -m isort --diff --color --check fmriprep + python -m ruff check --diff --color --check fmriprep + python -m ruff format --diff --color --check fmriprep - name: Check wrapper run: | - python -m black --diff --color --check wrapper - python -m isort --diff --color --check wrapper + python -m ruff check --diff --color --check wrapper + python -m ruff format --diff --color --check wrapper codespell: name: Check for spelling errors diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f2e907657..a385354cd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,13 +7,10 @@ repos: - id: end-of-file-fixer - id: check-yaml - id: check-added-large-files -- repo: https://github.com/psf/black - rev: 23.1.0 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.7 hooks: - - id: black + - id: ruff files: ^fmriprep/|^wrapper/ -- repo: https://github.com/pycqa/isort - rev: 5.12.0 - hooks: - - id: isort + - id: ruff-format files: ^fmriprep/|^wrapper/ diff --git a/pyproject.toml b/pyproject.toml index 5a1499c95..1ea78f5e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -57,9 +57,8 @@ doc = [ "sphinx_rtd_theme>=0.5.2", ] dev = [ - "black ~= 22.3.0", "pre-commit", - "isort ~= 5.10.1", + "ruff >= 0.1.8", "flake8-pyproject", ] duecredit = ["duecredit"] @@ -121,23 +120,17 @@ version-file = "fmriprep/_version.py" # Developer tool configurations # -[tool.black] +[tool.ruff] line-length = 99 target-version = ['py39'] -skip-string-normalization = true - -[tool.isort] -profile = 'black' - -[tool.flake8] -max-line-length = "99" -doctests = "False" -exclude = "*build/" -ignore = ["W503", "E203"] -per-file-ignores = [ - "**/__init__.py : F401", - "docs/conf.py : E265", -] +extend-select = ["I"] +exclude = ["*build/"] +extend-ignore = ["E203"] +quote-style = "preserve" + +[tool.ruff.lint.per-file-ignores] +"**/__init__.py" = ["E402"] +""docs/conf.py" = ["E265"] [tool.pytest.ini_options] norecursedirs = [".git"] diff --git a/wrapper/pyproject.toml b/wrapper/pyproject.toml index fb5800a8a..71a15c313 100644 --- a/wrapper/pyproject.toml +++ b/wrapper/pyproject.toml @@ -63,10 +63,7 @@ universal = true # Developer tool configurations # -[tool.black] +[tool.ruff] line-length = 99 target-version = ['py39'] -skip-string-normalization = true - -[tool.isort] -profile = 'black' +#skip-string-normalization = true