-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy path.ruff.toml
More file actions
107 lines (100 loc) · 4.41 KB
/
.ruff.toml
File metadata and controls
107 lines (100 loc) · 4.41 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
extend = "pyproject.toml"
exclude = [
".git",
"__pycache__",
"docs",
".eggs",
"build",
"dist",
".tox",
".eggs",
"**/tests/**/__init__.py",
"src/__init__.py",
]
line-length = 100
target-version = "py311"
[format]
quote-style = "double"
indent-style = "space"
docstring-code-format = true
[lint]
select = [
"F", # Pyflakes (part of default flake8)
"E", # pycodestyle (part of default flake8)
"W", # pycodestyle (part of default flake8)
"D", # docstrings, see also numpydoc_validation pre-commit action
"N", # pep8-naming (naming conventions)
"A", # flake8-builtins (prevent shadowing of builtins)
# "ARG", # flake8-unused-arguments (prevent unused arguments)
"B", # flake8-bugbear (miscellaneous best practices to avoid bugs)
"C4", # flake8-comprehensions (best practices for comprehensions)
"I", # isort
"ICN", # flake8-import-conventions (enforce import conventions)
"INP", # flake8-no-pep420 (prevent use of PEP420, i.e. implicit name spaces)
"ISC", # flake8-implicit-str-concat (conventions for concatenating long strings)
"LOG", # flake8-logging
"NPY", # numpy-specific rules
"PGH", # pygrep-hooks (ensure appropriate usage of noqa and type-ignore)
"PTH", # flake8-use-pathlib (enforce using Pathlib instead of os)
"RUF022", # unsorted-dunder-all
"S", # flake8-bandit (security checks)
"SLF", # flake8-self (prevent using private class members outside class)
"SLOT", # flake8-slots (require __slots__ for immutable classes)
"T20", # flake8-print (prevent print statements in code)
"TID252", # Checks for relative imports
"TRY", # tryceratops (best practices for try/except blocks)
"UP", # pyupgrade (simplified syntax allowed by newer Python versions)
"YTT", # flake8-2020 (prevent some specific gotchas from sys.version)
]
ignore = [
"D100", # missing docstring in public module
"D105", # missing docstring in magic method
"E741", # ambiguous variable name (O/0, l/I, etc.)
"UP008", # use super() instead of super(class, self). no harm being explicit
"UP015", # unnecessary open(file, "r"). no harm being explicit
"TRY003", # prevents custom exception messages not defined in exception itself.
"ISC001", # single line implicit string concatenation. formatter recommends ignoring this.
"PTH123", # use Path.open instead of open
# longer term fix
"S101", # asserts are used in many non-test places
"SLF001", # private member access, this is overly restrictive
]
[lint.pydocstyle]
convention = "numpy"
[lint.flake8-annotations]
ignore-fully-untyped = true # Turn of annotation checking for fully untyped code
[lint.per-file-ignores]
"**/test_*.py" = ["S101", "SLF001", "B011", "D104"]
"src/stdatamodels/jwst/datamodels/darkMIRI.py" = ["N999"]
"src/stdatamodels/jwst/transforms/converters/jwst_models.py" = [
"D",
] # all converters have same standard docstrings
"src/stdatamodels/jwst/datamodels/wcs_ref_models.py" = [
"D102",
] # all public methods are overriding base class, so are the same
"**/tests/**" = [
"E", # pycodestyle (part of default flake8)
"W", # pycodestyle (part of default flake8)
"D", # docstrings, see also numpydoc pre-commit action
"N", # pep8-naming (naming conventions)
"A", # flake8-builtins (prevent shadowing of builtins)
"ARG", # flake8-unused-arguments (prevent unused arguments)
"B", # flake8-bugbear (miscellaneous best practices to avoid bugs)
"C4", # flake8-comprehensions (best practices for comprehensions)
"F841", # Local variable `result` is assigned to but never used
"ICN", # flake8-import-conventions (enforce import conventions)
"INP", # flake8-no-pep420 (prevent use of PEP420, i.e. implicit name spaces)
"ISC", # flake8-implicit-str-concat (conventions for concatenating long strings)
"LOG", # flake8-logging
"NPY", # numpy-specific rules
"PGH", # pygrep-hooks (ensure appropriate usage of noqa and type-ignore)
"PTH", # flake8-use-pathlib (enforce using Pathlib instead of os)
"S", # flake8-bandit (security checks)
"SLF", # flake8-self (prevent using private class members outside class)
"SLOT", # flake8-slots (require __slots__ for immutable classes)
"TRY", # tryceratops (best practices for try/except blocks)
"UP", # pyupgrade (simplified syntax allowed by newer Python versions)
"YTT", # flake8-2020 (prevent some specific gotchas from sys.version)
]
[lint.isort]
known-first-party = ["stdatamodels"]