-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathruff.toml
More file actions
111 lines (103 loc) · 3.55 KB
/
ruff.toml
File metadata and controls
111 lines (103 loc) · 3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
extend-exclude = [".pixi/**/*", "tests/**/*.py", "src/imgtools/cli/**/*.py"]
cache-dir = ".cache/.ruff-cache"
line-length = 79
[lint]
select = [
###########################################################################
# TYPE ANNOTATIONS
# Ensure all functions have type annotations
# https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
"ANN",
# Use type hinting consistently
# https://docs.astral.sh/ruff/rules/#flake8-type-checking-tch
"TCH",
###########################################################################
# IMPORTS
# Sort imports naturally
# https://docs.astral.sh/ruff/rules/#isort-i
"I",
# Follow import conventions
# https://docs.astral.sh/ruff/rules/#flake8-import-conventions-icn
"ICN",
# Clean up and organize imports
# https://docs.astral.sh/ruff/rules/#flake8-tidy-imports-tid
"TID",
###########################################################################
# CODE QUALITY
# Detect possible bugs, like unused variables or exception handling issues
# https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
"B",
# Avoid using Python builtins incorrectly
# https://docs.astral.sh/ruff/rules/#flake8-builtins-a
"A",
# Enforce correct usage of commas in lists, tuples, etc.
# https://docs.astral.sh/ruff/rules/#flake8-commas-com
"COM",
# Prevent use of debugging code, like breakpoints
# https://docs.astral.sh/ruff/rules/#flake8-debugger-t10
"T10",
# Disallow print statements
# https://docs.astral.sh/ruff/rules/#flake8-print-t20
"T20",
# Provide clear and explanatory error messages
# https://docs.astral.sh/ruff/rules/#flake8-errmsg-em
"EM",
###########################################################################
# STANDARDS & STYLE
# Prefer pathlib for path manipulation
# https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
"PTH",
# Adhere to Pylint conventions
# https://docs.astral.sh/ruff/rules/#pylint-pl
"PL",
# Simplify code to reduce complexity
# https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
"SIM",
# errors like undefined names and unused imports without enforcing style rules.
# https://docs.astral.sh/ruff/rules/#pyflakes-f
"F",
#
# https://docs.astral.sh/ruff/rules/#pep8-naming-n
"N",
# Pydocstyle
# https://docs.astral.sh/ruff/rules/#pydocstyle-d
# "D",
###########################################################################
# MIGRATION TO NUMPY2
# https://numpy.org/doc/stable/numpy_2_0_migration_guide.html
"NPY201",
]
ignore = [
# Allow too many arguments for functions
"PLR0913",
"PLR2004",
# Public Module Docstrings
"D100",
# Ignored because https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
"COM812", # https://docs.astral.sh/ruff/rules/missing-trailing-comma/#missing-trailing-comma-com812
"D206",
"N813",
"EM101",
"PLC0415", # Ignore imports not at top of file
]
[lint.mccabe]
max-complexity = 10
[lint.pydocstyle]
convention = "numpy"
[lint.isort]
known-first-party = ["imgtools"]
combine-as-imports = true
relative-imports-order = "closest-to-furthest"
[lint.per-file-ignores]
"**/*.ipynb" = ["I", "F", "T20"]
"src/imgtools/dicom/dicom_metadata/*" = [
"N805", # First argument of a method should be named `self`, but we are using classproperty
]
"src/imgtools/utils/dictionaries.py" = [
"ANN401", # allow typing.Any
]
[format]
quote-style = "double"
indent-style = "space"
docstring-code-format = true
docstring-code-line-length = 49