Skip to content

Expand ruff linter rules #604

Description

@JAB1305

Current ruff linter configuration applies a certain set of rules. However more rules were already selected to be introduced at some point. These currently live in the ignore section and should be moved up to the select section.

The first introduction of these rules comes with some manual work to first get the codebase to the rules' standards.

A good way to add a rule is to introduce it step by step, e.g.:

  1. Run ruff check only against sdk/basyx
  2. If possible, apply fixes with ruff check --fix (or even unsafe-fixes)
  3. Run tests (mypy tends to surface errors) to see if fixes are breaking
  4. Only then expand to tests, repeat for other modules

Checklist (also see ruff.toml) of open rules:

PYI currently requires an additional dependency; after the introduction of a newer python version this can easily be introduced (see #594)

  • "PYI", # typing best practices

Might need more work to add:

  • "F403", # star imports - high existing usage
  • "F405", # may-be-undefined from star imports
  • "N818", # Exception name should be named with Error suffix
  • "N", # pep8-naming
  • "B", # flake8-bugbear
  • "T20", # prevent native print() statements
  • "A", # prevent shadowing of python builtins
  • "FIX", # prevent the creation of T0DO / F1XME comments

Should be evaluated if we even want to add them:

  • "S", # security related precautions
  • "BLE", # prevent unspecified excepts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions