opsmill / infrahub

Infrahub - A new approach to Infrastructure Management
https://opsmill.com/
GNU Affero General Public License v3.0
185 stars 8 forks source link

task: remove deprecated Ruff checks #4020

Open lykinsbd opened 1 month ago

lykinsbd commented 1 month ago

Component

Not Sure

Task Description

JSON Schema validation of the two pyproject.toml files in Infrahub fails with the following error:

{"preview":true,"task-tags":["FIXME","TODO","XXX"],"select":["ASYNC","B","C4","C90","DJ","DTZ","E","EXE","F","I","ICN","INP","N","PIE","PL","PTH","PYI","Q","RET","S","TCH","TRIO","T10","UP","W","YTT"],"ignore":["ASYNC101","B007","B008","B009","B010","B904","C403","C409","C414","N801","N802","N805","N806","N812","PLC0415","PLC2701","PLR0904","PLR0912","PLR0913","PLR0914","PLR0915","PLR0916","PLR0917","PLR1702","PLR2004","PLR6201","PLR6301","PLW0603","PLW1508","PLW3201","PTH100","PTH102","PTH103","PTH107","PTH108","PTH109","PTH110","PTH112","PTH113","PTH117","PTH118","RET503","RET504","S101","S105","S108","S202","S311","S701","UP007","UP008","UP012","UP018","UP031","UP034"],"isort":{"known-first-party":["infrahub"]},"pycodestyle":{"max-line-length":150},"mccabe":{"max-complexity":33},"per-file-ignores":{"backend/infrahub/git/repository.py":["TCH003"],"backend/tests/**.py":["S101","S105","S106"],"models/infrastructure_edge.py":["S106","C901","E501"]}} is not valid under any of the given schemas
<snip> is not valid under any of the given schemas

Upon closer inspection, this is correct, and the configuration as stands is not valid:

https://www.jsonschemavalidator.net/s/JS9mMhoM

Found 2 error(s) Message: Value "TRIO" is not defined in enum. Schema path: https://json.schemastore.org/ruff.json#/definitions/RuleSelector/enum Message: Value "ASYNC101" is not defined in enum. Schema path: https://json.schemastore.org/ruff.json#/definitions/RuleSelector/enum

There are two problems:

  1. The TRIO checks have been deprecated and moved/renamed to ASYNC
  2. The ASYNC101 check has been deprecated and split into five other checks:
    1. ASYNC220
    2. ASYNC221
    3. ASYNC222
    4. ASYNC230
    5. ASYNC251

See: https://github.com/astral-sh/ruff/pull/10416

Two fixes needed:

  1. tool.ruff.lint.select of TRIO can be removed, as it is covered by ASYNC
  2. tool.ruff.lint.ignore of ASYNC101 can be removed and replaced by the 5 listed checks above
lykinsbd commented 1 month ago

This looks to be already resolved in Develop; I was seeing it in Stable.