Skip to content

Commit 534966c

Browse files
cclaussamilcarlucas
authored andcommitted
chore(ruff): Set upper limits on code complexity
Setting upper limits on code complexity can trigger code review discussions to understand if increasing complexity and reducing maintainability are required. These can also be metrics for continuous improvement.
1 parent d0908c6 commit 534966c

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

ardupilot_methodic_configurator/tempcal_imu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def constrain(value: float, minv: float, maxv: float) -> Union[float, int]:
288288
return min(maxv, value)
289289

290290

291-
def IMUfit( # noqa: PLR0915, N802, pylint: disable=too-many-locals, too-many-branches, too-many-statements, too-many-arguments, too-many-positional-arguments
291+
def IMUfit( # noqa: C901, PLR0912, PLR0915, N802, pylint: disable=too-many-locals, too-many-branches, too-many-statements, too-many-arguments, too-many-positional-arguments
292292
logfile: str,
293293
outfile: str,
294294
no_graph: bool,

pyproject.toml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ lint.select = [
134134
"F", # Pyflakes
135135
"E", # pycodestyle -Error
136136
"W", # pycodestyle - Warning
137-
#"C901", # maccabe
137+
"C90", # maccabe
138138
"I", # isort
139139
"N", # pep8-naming
140140
"D", # pydocstyle
@@ -187,9 +187,6 @@ lint.select = [
187187
]
188188

189189
lint.ignore = [
190-
"PLR0912", # too many branches
191-
"PLR0913", # too many arguments
192-
"PLR2004", # Magic value used in comparison, consider replacing `X` with a constant variable
193190
"ISC001", # to let formatter run
194191
"ANN002",
195192
"ANN003",
@@ -215,6 +212,14 @@ indent-width = 4
215212
"ardupilot_methodic_configurator/backend_mavftp_example.py" = ["ANN001"]
216213
"ardupilot_methodic_configurator/tempcal_imu.py" = ["ANN001"]
217214

215+
[tool.ruff.lint.mccabe]
216+
max-complexity = 22 # Default is 10
217+
218+
[tool.ruff.lint.pylint]
219+
allow-magic-value-types = ["bytes", "float", "int", "str"]
220+
max-args = 9 # Default is 5
221+
max-branches = 24 # Default is 12
222+
218223
[tool.mypy]
219224
ignore_missing_imports = true
220225
disallow_any_unimported = false

0 commit comments

Comments
 (0)