forked from aristanetworks/avd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpyproject.toml
More file actions
136 lines (126 loc) · 6.78 KB
/
pyproject.toml
File metadata and controls
136 lines (126 loc) · 6.78 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
[tool.black]
# Black has been replaced with Ruff.
force-exclude = '''.*'''
[tool.isort]
# Isort has been replaced with Ruff.
skip_glob = [
"**/*"
]
[tool.ruff]
line-length = 160
extend-exclude = [
"python-avd/pyavd/_cv/api/**/*",
"python-avd/tests/pyavd/schema/data_merging_schema_class.py", # File is generated during pytest
"ansible_collections/arista/avd/tests/**/*",
]
target-version = "py310"
[tool.ruff.lint]
# D213 is forced here since it will be removed by pydocstyle.convention = 'google' even when we have ALL here.
extend-select = ["ALL", "D213"]
ignore = [
"D203", # Ignoring conflicting D* warnings - one-blank-line-before-class
"D212", # Ignoring conflicting D* warnings - multi-line-summary-first-line
"COM812", # Ignoring conflicting rules that may cause conflicts when used with the formatter
"ISC001", # Ignoring conflicting rules that may cause conflicts when used with the formatter
"TD002", # We don't have require authors in TODO
"TD003", # We don't have an issue link for all TODOs today
"FIX002", # Line contains TODO - ignoring for ruff for now
"SLF001", # Accessing private members - TODO: Improve code
"D100", # Missing docstring in public module - TODO: Improve code
"D101", # Missing docstring in public class - TODO: Improve code
"D102", # Missing docstring in public method - TODO: Improve code
"D103", # Missing docstring in public function - TODO: Improve code
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method - TODO: Improve code
"D106", # Missing docstring in public nested class - TODO: Improve code
"D107", # Missing docstring in `__init__` - TODO: Improve code
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed - TODO: Improve code
"C901", # complex-structure - TODO: Improve code
"FBT001", # Boolean-typed positional argument in function definition - TODO: Improve code
"FBT002", # Boolean default positional argument in function definition - TODO: Improve code
"PD011", # Use numpy instead of .values - False positive
"BLE001", # Do not catch blind exception: `Exception - TODO: Improve code
"PLR2004", # Magic value used in comparison - TODO: Evaluate
"DTZ005", # `datetime.datetime.now()` called without a `tz` argument - TODO: Improve code
"UP038", # UP038 Use `X | Y` in `isinstance` call instead of `(X, Y)` - Why would I? It impacts performance.
"ASYNC109",# async-function-with-timeout: Our async functions call several other async functions and we need each of those calls to be governed by the configurable timeout.
]
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.ruff.lint.per-file-ignores]
"ansible_collections/arista/avd/plugins/*/*.py" = [
"E402", # Ansible plugins require a layout with imports below the docs
"INP001", # implicit namespace package. Add an `__init__.py` - Ansible plugins are not in packages
]
"ansible_collections/arista/avd/roles/eos_validate_state/python_modules/**/*.py" = [
"INP001", # implicit namespace package. Add an `__init__.py` - Will be fixed once moved to PyAVD
]
"ansible_collections/arista/avd/molecule/eos_designs_unit_tests/custom_modules/*.py" = [
"INP001", # implicit namespace package. Add an `__init__.py` - TODO: Evaluate or see if it is a false positive
]
"python-avd/scripts/**/*.py" = [
"T201", # Interactive scripts can have print
"INP001", # implicit namespace package. Add an `__init__.py` - TODO: Evaluate or see if it is a false positive
]
"python-avd/pyavd/_cv/client/*.py" = [
"B904", # Within an `except` clause, raise exceptions with `raise - TODO: Improve code
]
"python-avd/pyavd/_eos_cli_config_gen/schema/__init__.py" = [
"A002", # Argument is shadowing a Python builtin - OK since these are data classes
"PLR0913", # Too many arguments in function definition - OK since these are data classes
"N803", # Argument name should be lowercase - TODO AVD6.0.0 can be removed when Vxlan1 is gone.
"N815", # Variable in class scope should not be mixedCase - TODO AVD6.0.0 can be removed when Vxlan1 is gone.
"E501", # Line too long - OK since we may have some very long vars or deeply nested with a long one-line description.
"S107", # Possible hardcoded password assigned to function default - False positive.
"F811", # Redefinition of unused `Vxlan1` from line 45778 - TODO AVD6.0.0 can be removed when Vxlan1 is gone.
"D205", # 1 blank line required between summary line and description - OK since descriptions are autogenerated and for data fields.
]
"python-avd/pyavd/_eos_designs/schema/__init__.py" = [
"A002", # Argument is shadowing a Python builtin - OK since these are data classes
"PLR0913", # Too many arguments in function definition - OK since these are data classes
"N803", # Argument name should be lowercase - TODO AVD6.0.0 can be removed when Vxlan1 is gone.
"E501", # Line too long - OK since we may have some very long vars or deeply nested with a long one-line description.
"S107", # Possible hardcoded password assigned to function default - False positive.
"S104", # Possible binding to all interfaces - False positive.
"D205", # 1 blank line required between summary line and description - OK since descriptions are autogenerated and for data fields.
]
"python-avd/pyavd/_eos_designs/eos_designs_facts/schema/protocol.py" = [
"A002", # Argument is shadowing a Python builtin - OK since these are data classes
"PLR0913", # Too many arguments in function definition - OK since these are data classes
"D205", # 1 blank line required between summary line and description - OK since descriptions are autogenerated and for data fields.
]
"python-avd/tests/**/*" = [
"S101", # Accept 'assert' in pytest.
"INP001", # implicit namespace package. Add an `__init__.py` - Tests are not in packages
]
"python/**/tests/**/*" = [
"S101", # Accept 'assert' in pytest.
"INP001", # implicit namespace package. Add an `__init__.py` - Tests are not in packages
]
"python-avd/pyavd/_anta/index.py" = [
"F403", # Allow wildcard imports to avoid cluttering the index
"F405", # Allow names defined in via a wildcard import
]
[tool.ruff.lint.pylint]
max-args = 15
max-branches = 54
max-returns = 10
max-statements = 148
[tool.ruff.lint.isort]
known-first-party = ["avdutils", "pyavd", "schema_tools"]
[tool.ruff.format]
docstring-code-format = true
[tool.ruff.lint.flake8-type-checking]
# These classes require that type annotations be available at runtime
runtime-evaluated-base-classes = ["pydantic.BaseModel"]
[tool.pyright]
include = [
".github",
"python-avd/pyavd/_eos_designs",
]
exclude = [
"python-avd/pyavd/_eos_designs/schema/__init__.py",
"python-avd/pyavd/_eos_designs/eos_designs_facts/schema/protocol.py",
"python-avd/pyavd/_eos_designs/j2templates/compiled_templates",
]
pythonVersion = "3.10"