Skip to content

Try ruff linter #32174

Description

@jmbowman

ruff is a relatively new Python linter implemented in Rust which is dramatically faster than pylint (as in, more than 2 orders of magnitude). It doesn't yet implement all of the pylint checks we use (progress in implementing the out-of-the-box pylint checks is being tracked in astral-sh/ruff#970), but there are at least three good reasons to try it out now anyway:

  • Even an incomplete set of checks that can be run across all of edx-platform very quickly could significantly reduce the feedback loop duration in catching many common problems.
  • If we can run both ruff and pylint, and turn off the pylint checks that ruff also implements, it may significantly reduce the overall time spent on linting.
  • ruff does probably implement some checks that pylint doesn't, which may be useful to run against our code.

Proposed A/C:

  • Add ruff as a quality checks dependency
  • Add a ruff configuration with a set of checks that currently pass. If there are additional checks that would be nice to have but currently fail, note them in comments in the configuration.
  • Run that ruff configuration as part of the GitHub Actions quality check workflows (may be able to add to a current catch-all workflow instead of adding a new one).
  • Write down the current typical duration of each pylint GitHub Actions workflow.
  • Disable all of the pylint checks also implemented in the chosen ruff configuration.
  • Write down the new pylint durations, and see if there's a significant difference.
  • Collect feedback on the results before deciding whether to merge.

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