Skip to content

Add the linter 'ruff' to pre-commit

Daniel Tang requested to merge feature/ruff into dev

Changes

This PR:

  • edits package dependencies in environment.yml,
  • runs pre-commit autoupdate to update pre-commit-config.yaml versions,
  • replaces isort with the more comprehensive ruff linter in pre-commit,
  • configures the ruff linter with the pyproject.yaml file, and
  • fixes code issues caught by the configured ruff linter.

Pre-commit

When run with pre-commit, ruff will attempt to auto-fix all issues automatically and make them available as unstaged changes to be committed.

In the future when ruff supports autoformatting according to Black's style we can also use ruff's autoformatting capabilities as well.

Note to Reviewers

@luke.davis I would recommend trying to build the conda/mamba environment file from scratch to ensure dependencies resolve properly, as some changes have also been made to dependencies/channels in the environment.yml file.

To create the environment using mamba from the default file path (environment.yml) and with the default specified virtual environment name (spiir-py38) try simply running:

mamba env create

Otherwise you can change it for testing with

mamba env create -f environment.yml -n spiir-py38-test
Edited by Daniel Tang

Merge request reports