opsmill / infrahub

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

task: Activate "RET" rule for ruff #2192

Open ogenstad opened 9 months ago

ogenstad commented 9 months ago

Component

API Server / GraphQL, Git Integration, Python SDK, infrahubctl CLI

Task Description

We should activate the "RET" rule for ruff in all our pyproject.toml files, to clean up some of our code. There are a number of violations but it looks like ruff can automatically fix them.

❯ ruff check .
backend/infrahub/api/schema.py:123:5: RET503 Missing explicit `return` at the end of function able to return non-`None` value
backend/infrahub/auth.py:134:12: RET504 Unnecessary assignment to `access_token` before `return` statement
backend/infrahub/auth.py:150:12: RET504 Unnecessary assignment to `refresh_token` before `return` statement
backend/infrahub/core/attribute.py:235:16: RET504 Unnecessary assignment to `value` before `return` statement
backend/infrahub/core/node/__init__.py:258:16: RET504 Unnecessary assignment to `rm` before `return` statement
backend/infrahub/core/node/__init__.py:278:16: RET504 Unnecessary assignment to `attr` before `return` statement
backend/infrahub/core/node/base.py:82:16: RET504 Unnecessary assignment to `base_cls` before `return` statement
ogenstad commented 9 months ago

This rule has been added to the ruff config in #2448, however the failing sub rules has been added to the ignore section. The goal of this issue now is to remove those ignore lines.