Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

CI: replace flake8 by ruff check #139

Merged
merged 10 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/contrib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defaults:

jobs:
stable:
name: Run flake8
name: Run ruff
runs-on: ubuntu-latest

steps:
Expand All @@ -20,4 +20,4 @@ jobs:
with:
python-version: 3
- name: Lint EddyMotion
run: pipx run flake8-pyproject
run: pipx run ruff check
35 changes: 25 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -136,18 +136,33 @@ exclude = '''
profile = 'black'
skip_gitignore = true

[tool.flake8]
max-line-length = 99
doctests = false
exclude = ["*build/", "docs/"]
select = "C,E,F,W,B,B950"
ignore = "N802,N806,W503,E203"
per-file-ignores = [
"*/__init__.py: F401",
"docs/conf.py: E265",
"/^\\s*\\.\\. _.*?: http/: E501"
[tool.ruff]
line-length = 99

[tool.ruff.lint]
select = [
"F",
"E",
"C",
"W",
"B",
]
ignore = [
"E203"
]

[tool.ruff.lint.flake8-quotes]
inline-quotes = "double"

[tool.ruff.lint.extend-per-file-ignores]
"*/__init__.py" = ["F401"]
"docs/conf.py" = ["E265"]
"/^\\s*\\.\\. _.*?: http/" = ["E501"]
"src/eddymotion/estimator.py" = ["C901"]

esavary marked this conversation as resolved.
Show resolved Hide resolved
[tool.ruff.format]
quote-style = "double"

[tool.pytest.ini_options]
pythonpath = "src/ test/"
norecursedirs = [".*", "_*"]
Expand Down
3 changes: 2 additions & 1 deletion src/eddymotion/data/dmri.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ def load(
if bvec_file and bval_file:
warn(
"Gradients table file and b-vec/val files are defined; "
"dismissing b-vec/val files."
"dismissing b-vec/val files.",
stacklevel=2
)
elif bvec_file and bval_file:
grad = np.vstack(
Expand Down
2 changes: 1 addition & 1 deletion src/eddymotion/model/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class BaseModel:
"_models",
"_datashape",
)
_modelargs = tuple()
_modelargs = ()

def __init__(self, gtab, S0=None, mask=None, b_max=None, **kwargs):
"""Base initialization."""
Expand Down
4 changes: 2 additions & 2 deletions src/eddymotion/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def plot_carpet(
segmentation_masked = segmentation_reshaped[segmentation_reshaped > 0]

if segment_labels is not None:
segments = dict()
segments = {}
labels = list(segment_labels.keys())
for label in labels:
indices = np.array([], dtype=int)
Expand Down Expand Up @@ -395,7 +395,7 @@ def get_segment_labels(filepath, keywords, delimiter=" ", index_position=0, labe
'Cerebral_Cortex': [3, 42],
'Ventricle': [4, 14, 15, 43, 72]}
"""
segment_labels = dict()
segment_labels = {}

with open(filepath, "r") as f:
labels = f.read()
Expand Down