@@ -12,6 +12,10 @@ dependencies = []
12
12
13
13
[dependency-groups ]
14
14
dev = [
15
+ " pre-commit" ,
16
+ " pyright" ,
17
+ " ruff" ,
18
+
15
19
" pytest" ,
16
20
" allure-pytest" ,
17
21
" pytest-subtests" ,
@@ -39,3 +43,113 @@ environments = [
39
43
[build-system ]
40
44
requires = [" uv-build" ]
41
45
build-backend = " uv_build"
46
+
47
+ # inspired from https://github.com/red-hat-data-services/ods-ci/blob/master/pyproject.toml
48
+
49
+ # https://microsoft.github.io/pyright/#/configuration
50
+ [tool .pyright ]
51
+ typeCheckingMode = " off"
52
+ reportMissingImports = " error"
53
+ reportUnboundVariable = " error"
54
+ reportGeneralTypeIssues = " error"
55
+ reportUnnecessaryTypeIgnoreComment = " error"
56
+ reportPossiblyUnboundVariable = " warning"
57
+ reportOptionalMemberAccess = " none"
58
+ reportOptionalSubscript = " none"
59
+ include = [" ci/" , " tests/" ]
60
+ ignore = [ ]
61
+ pythonVersion = " 3.12"
62
+ pythonPlatform = " Linux"
63
+
64
+ # https://docs.astral.sh/ruff/configuration
65
+ [tool .ruff ]
66
+ include = [" pyproject.toml" , " ci/**/*.py" , " tests/**/*.py" ]
67
+ exclude = [ ]
68
+ target-version = " py312"
69
+ line-length = 120
70
+
71
+ # https://docs.astral.sh/ruff/rules
72
+ [tool .ruff .lint ]
73
+ preview = true
74
+ select = [
75
+ " B" , # flake8-bugbear
76
+ " C4" , # flake8-comprehensions
77
+ " COM" , # flake8-commas
78
+ " E" , " W" , # pycodestyle errors/warnings
79
+ " F" , # Pyflakes
80
+ " FA" , # flake8-future-annotations
81
+ " FLY" , # flynt
82
+ " G" , # flake8-logging-format
83
+ " I" , # isort
84
+ " INP" , # flake8-no-pep420
85
+ " INT" , # flake8-gettext
86
+ " ISC" , # flake8-implicit-str-concat
87
+ " N" , # pep8-naming
88
+ " NPY002" , # numpy-legacy-random
89
+ " PERF" , # Perflint
90
+ " PGH" , # pygrep-hooks
91
+ " PIE" , # misc lints
92
+ " PL" , # pylint
93
+ " PYI" , # flake8-pyi
94
+ " Q" , # flake8-quotes
95
+ " RET" , # flake8-return
96
+ " RUF" , # Ruff-specific
97
+ " S102" , # flake8-bandit: exec-builtin
98
+ " T10" , # flake8-debugger
99
+ " TCH" , # type-checking imports
100
+ " TID" , # flake8-tidy-imports
101
+ " UP" , # pyupgrade
102
+ " YTT" , # flake8-2020
103
+ ]
104
+ ignore = [
105
+ # intentionally disabled
106
+ " E203" , # space before : (needed for how black formats slicing)
107
+ " ISC001" , # single-line-implicit-string-concatenation (ruff format wants this disabled)
108
+ # various limits and unimportant warnings
109
+ " E501" , # Line too long
110
+ " E741" , # Ambiguous variable name: `l`
111
+ " PLR0904" , # Too many public methods (56 > 20)
112
+ " PLR0912" , # Too many branches
113
+ " PLR0913" , # Too many arguments in function definition (6 > 5)
114
+ " PLR0915" , # Too many statements
115
+ " PLR0917" , # Too many positional arguments (10/5)
116
+ " PLR0917" , # Too many positional arguments (7/5)
117
+ " PLR2004" , # Magic value used in comparison
118
+ # "W503", # not yet implemented; line break before binary operator
119
+ # "W504", # not yet implemented; line break after binary operator
120
+ # TODO
121
+ " B006" , # Do not use mutable data structures for argument defaults
122
+ " COM812" , # Trailing comma missing
123
+ " INP001" , # File `ods_ci/tests/Resources/Page/ODH/JupyterHub/jupyter-helper.py` is part of an implicit namespace package. Add an `__init__.py`.
124
+ " N806" , # Variable `outputText` in function should be lowercase
125
+ " N813" , # Camelcase `ElementTree` imported as lowercase `et`
126
+ " N816" , # Variable `rotatingHandler` in global scope should not be mixedCase
127
+ " N999" , # Invalid module name: 'createPolarionTestRun'
128
+ " PERF401" , # Use a list comprehension to create a transformed list
129
+ " PLC1901" , # `filter_value != ""` can be simplified to `filter_value` as an empty string is falsey
130
+ " PLR6201" , # Use a `set` literal when testing for membership
131
+ " PLR6301" , # Method `_render_template` could be a function, class method, or static method
132
+ " PLW1514" , # `codecs.open` in text mode without explicit `encoding` argument
133
+ " PLW2901" , # `for` loop variable `tag_it` overwritten by assignment target
134
+ " RET501" , # Do not explicitly `return None` in function if it is the only possible return value
135
+ " RET504" , # Unnecessary assignment to `names` before `return` statement
136
+ " RET505" , # Unnecessary `else` after `return` statement
137
+ " UP015" , # Unnecessary open mode parameters
138
+ " UP031" , # format specifiers instead of percent format
139
+ " UP032" , # Use f-string instead of `format` call
140
+ " RET507" , # Unnecessary `else` after `continue` statement
141
+ " RET508" , # Unnecessary `elif` after `break` statement
142
+ ]
143
+
144
+ # Allow unused variables when underscore-prefixed.
145
+ dummy-variable-rgx = " ^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
146
+
147
+ # https://docs.astral.sh/ruff/formatter
148
+ [tool .ruff .format ]
149
+ line-ending = " lf"
150
+ quote-style = " double"
151
+ indent-style = " space"
152
+ skip-magic-trailing-comma = false
153
+
154
+ docstring-code-format = true
155
+ docstring-code-line-length = " dynamic"
0 commit comments