-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathruff.toml
More file actions
118 lines (105 loc) · 3.4 KB
/
ruff.toml
File metadata and controls
118 lines (105 loc) · 3.4 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
112
113
114
115
116
117
118
# Ruff configuration
####################
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]
# Enforce line length and indent-width
line-length = 120
indent-width = 4
# Ignores anything in .gitignore
respect-gitignore = true
# Always generate Python 3.12-compatible code
target-version = "py312"
[lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
select = [
"E4", # pycodestyle: import-related errors
"E7", # pycodestyle: statement-related errors (e.g., multiple statements on one line)
"E9", # pycodestyle: runtime errors (syntax errors, IO errors)
"F", # pyflakes: detects unused imports/variables, undefined names, etc.
]
extend-select = [
"C4", # flake8-comprehensions: unnecessary list/dict/set comprehensions
"E1", # pycodestyle: indentation errors (unexpected/missing indent)
"E2", # pycodestyle: whitespace errors (missing/extra spaces around operators)
"E3", # pycodestyle: blank line violations around definitions
"E501", # pycodestyle: line too long
"I", # isort: import sorting and grouping
"ISC", # flake8-implicit-str-concat: implicit string concatenation detection
"RET", # flake8-return: return statement consistency (redundant else, missing returns)
"SLF", # flake8-self: private member access violations (_prefixed attributes)
"SIM", # flake8-simplify: code simplification suggestions
"RUF022",# ruff: enforce sorted `__all__` lists
"UP", # pyupgrade: modernize syntax for target Python version
"W", # pycodestyle warnings: style warnings (whitespace, newlines, deprecations)
]
ignore = [
"D100", # pydocstyle: missing docstring in public module
"D104", # pydocstyle: missing docstring in public package (__init__.py)
"D105", # pydocstyle: missing docstring in magic method
"D106", # pydocstyle: missing docstring in nested class
"D107", # pydocstyle: missing docstring in __init__
"F403", # pyflakes: `from ... import *` used; unable to detect undefined names
"F405", # pyflakes: name may be undefined or defined from star imports
"RET504", # flake8-return: unnecessary variable assignment before `return`
"UP032", # pyupgrade: prefer f-strings over `str.format()`
]
preview = true
# 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.flake8-self]
ignore-names = ["_meta", "Meta"]
[lint.isort]
known-first-party = [
"account",
"circuits",
"core",
"dcim",
"extras",
"ipam",
"netbox",
"tenancy",
"users",
"utilities",
"virtualization",
"vpn",
"wireless",
]
[format]
# Like Black, use double quotes for strings.
quote-style = "double"
# Indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Enforce UNIX line ending
line-ending = "lf"