Repository navigation
Expand file tree
/
Copy pathruff.toml
More file actions
87 lines (79 loc) · 2.81 KB
/
Copy pathruff.toml
File metadata and controls
87 lines (79 loc) · 2.81 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
# Ruff configuration for dendritic-modeling project
# Target the package minimum from pyproject.toml.
target-version = "py310"
# Same as Black
line-length = 88
# Exclude a variety of commonly ignored directories
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"*.ipynb", # Ignore Jupyter notebooks
]
[lint]
# Linting only: black formats and isort orders imports (pyproject.toml).
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # Pyflakes
"N", # pep8-naming
"UP", # pyupgrade
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"PIE", # flake8-pie
"PYI", # flake8-pyi
"RUF", # Ruff-specific rules
]
# Never enforce these rules
ignore = [
"E501", # Line too long (handled by black)
"E203", # Whitespace before ':' (conflicts with black)
"B008", # Do not perform function calls in argument defaults
"B904", # Within an `except` clause, raise exceptions with `raise ... from err`
"B905", # zip(strict=...) migration deferred for current style
"N803", # Argument name should be lowercase (for mathematical variables)
"N806", # Variable in function should be lowercase (for mathematical variables)
"N812", # Lowercase imported as non-lowercase (e.g., torch.nn.functional as F)
"N815", # Variable in class scope should not be mixedCase (domain: E/I/V traces)
"UP007", # Keep Optional[...] annotations for consistency
"UP045", # Keep Optional[...] annotations for consistency with current codebase
]
# Allow fix for all enabled rules (when `--fix`) is provided
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[lint.per-file-ignores]
# Config files can have longer lines
"**/config.py" = ["E501"]
# __init__.py files can have unused imports
"__init__.py" = ["F401"]
# Kernel code uses short math-loop names (i, j, l) by convention.
"src/dendritic_modeling/networks/architectures/excitation_inhibition/synapse/kernels/**" = ["E741"]
"src/dendritic_modeling/kernels/**" = ["E741"]
# CLI entry-point scripts set environment/backends before imports by design
# (matplotlib backend, offline HF env, CUDA config) — the module-level
# import-position rule does not fit them.
"src/dendritic_modeling/scripts/training/**" = ["E402"]
"src/dendritic_modeling/scripts/analysis/**" = ["E402"]
"src/dendritic_modeling/scripts/benchmarks/**" = ["E402"]
"src/dendritic_modeling/scripts/script_utils/**" = ["E402"]
"src/dendritic_modeling/scripts/sweeps/**" = ["E402"]