Skip to content

Use Ruff for linting and formatting #195

@feegeer

Description

@feegeer

Is your feature request related to the way how to work with pyLife, i.e. the API.? If yes, please describe.

My feature request is related to the linting / formatting of the pylife code. Specifically, I noticed, that

  • there are some very long lines, for example in notch_approximation_law_seegerbeste (187 characters), which is inconvenient especially if you take a look at the code on GitHub, since you need to scroll horizontally
  • the imports are not always alphabetically sorted. I would suggest to be more consistent about this so that imports can be spotted as easily as possible.
  • here and there, there are some unused imports, which makes it harder to see what is actually used in the respective module

As currently, only a linter is used (flake8) and no formatter, I would like to propose to add ruff, as it is quite fast and can do everything that flake8 can do, and even more. This would in my opinion also have the benefit that future contributions coming from different persons would be consistent in their style.

Is your feature request about new functionality, new calculation model? If yes please describe
No

Describe the solution you'd like

  • replace flake8 with ruff with a similar ruleset, that I would first propose to you, specified in the pyproject.toml
  • reformat everything and fix linter warnings, if applicable
  • add ruff linting and formatting to the PR checks
  • update the documentation regarding formatting and linting

Indicate if you or someone you know would volunteer to work on this
I would volunteer to work on this.

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