opsmill / infrahub-sdk-python

Python SDK to interact with Infrahub
https://www.opsmill.com
Apache License 2.0
3 stars 2 forks source link

Upgrade ruff to 0.7.1 #108

Closed ogenstad closed 4 weeks ago

ogenstad commented 4 weeks ago

Upgrade ruff and fix an issue with ruff rule: RUF031 [*] Avoid parentheses for tuples in subscripts.

This is mostly to fix an issue related to python SDK being on an earlier version compared to infrahub server.

So in the server code we'd get:

❯ ruff check .
python_sdk/infrahub_sdk/transfer/exporter/json.py:57:55: RUF031 [*] Avoid parentheses for tuples in subscripts.
   |
55 |                     # Record the relationship only if it's not known in one way or another
56 |                     if not forward and not backward:
57 |                         many_relationship_identifiers[(node_schema.kind, relationship.peer)] = relationship.identifier
   |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF031
58 |
59 |         return many_relationship_identifiers
   |
   = help: Remove the parentheses.

Found 1 error.
[*] 1 fixable with the `--fix` option.

I think it's because RUF031 probably didn't exist in ruff 0.5.0 so it was not disabled in the SDK config.

We could also disable checking within the SDK directory from the main project but I think it's quite convenient to be able to have everything in one command when working against both code bases.

codecov[bot] commented 4 weeks ago

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
infrahub_sdk/transfer/exporter/json.py 0.00% 1 Missing :warning:
@@           Coverage Diff            @@
##           develop     #108   +/-   ##
========================================
  Coverage    64.27%   64.27%           
========================================
  Files           74       74           
  Lines         6856     6856           
  Branches      1355     1355           
========================================
  Hits          4407     4407           
  Misses        2098     2098           
  Partials       351      351           
Flag Coverage Δ
python-3.10 43.26% <0.00%> (ø)
python-3.11 43.26% <0.00%> (ø)
python-3.12 43.26% <0.00%> (ø)
python-3.9 43.20% <0.00%> (ø)
python-filler-3.12 23.89% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
infrahub_sdk/transfer/exporter/json.py 19.79% <0.00%> (ø)