opsmill / infrahub

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

task: Invalid arguments to ruff in lint job #3658

Open ogenstad opened 4 weeks ago

ogenstad commented 4 weeks ago

Component

CI/CD

Task Description

Within the lint job we run ruff check --diff . (https://github.com/opsmill/infrahub/blob/infrahub-v0.14.1/.github/workflows/ci.yml#L122)

It seems this command can return a zero exit code even if errors are found, see below for reference. I'm not sure if the behaviour has changed in later versions of ruff but given that ruff check . returns the correct exit code along with more information we should switch to using that instead.

❯ ruff check .
sync/infrahub-sync/infrahub_sync/adapters/ipfabricsync.py:83:15: UP006 Use `dict` instead of `Dict` for type annotation
Found 1 error.
No fixes available (1 hidden fix can be enabled with the `--unsafe-fixes` option).

infrahub on  pog-number-pool [$] via 🐳 desktop-linux is 📦 v0.15.0-dev via  v20.12.2 via 🐍 v3.12.3 (infrahub)
❯ echo $?
1

infrahub on  pog-number-pool [$] via 🐳 desktop-linux is 📦 v0.15.0-dev via  v20.12.2 via 🐍 v3.12.3 (infrahub)
❯ ruff check --diff .
No errors would be fixed (1 fix available with `--unsafe-fixes`).

infrahub on  pog-number-pool [$] via 🐳 desktop-linux is 📦 v0.15.0-dev via  v20.12.2 via 🐍 v3.12.3 (infrahub)
❯ echo $?
0