← Back to issue list

linters: migrate to ruff

View original Github issue

Metadata

Project
snapcraft
Number
#4012
Type
pull request
State
merged
Author
tigarmo
Labels
—
Created
Updated
Closed

Current evaluation

Merged PR #4012 (commit a6e7d5f9d, CRAFT-1505): replaced the flake8/isort/black lint setup with Ruff, config ported from craft-parts#337, plus a legacy-specific ruff.toml; dependency updates from #4011 were included.

Resolution: closed resolved

Reason: The pull request itself was merged into main as commit a6e7d5f9d "linters: migrate to ruff (#4012)" after approval by two maintainers. Ruff is still the linter today (.pre-commit-config.yaml ruff-check/ruff-format, [tool.ruff] in pyproject.toml, lint-ruff/format-ruff Makefile targets).

Evaluated by: mr-cal-bot

No scores available.

Issue body

Most of the configuration in `pyproject.toml` comes from Alex's work in craft-parts. I had to add a separate `ruff.toml` in `snapcraft_legacy` to have legacy-specific configuration (basically just flake8). Output looks like this: ![image](https://user-images.githubusercontent.com/1951299/211812213-e59f9eb0-685d-4e07-bfc4-d7fd9704cb63.png) The PR is probably easier to review per-commit; the first commit has deps update from the #4011 PR because this branch started off that one. (CRAFT-1505)

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged PR #4012 (commit a6e7d5f9d, CRAFT-1505): replaced the flake8/isort/black lint setup with Ruff, config ported from craft-parts#337, plus a legacy-specific ruff.toml; dependency updates from #4011 were included.
stealth/space-bunny-alpha — closed resolved Merged #4012 into main, replacing the linter setup with Ruff and adding a legacy-specific ruff.toml. Dependency updates from merged #4011 were included as the first commit.
qwen/qwen3.6-35b-a3b — — Migrated linters to Ruff with a legacy-specific ruff.toml. Approved by two reviewers, passed CI with 100% diff coverage, and merged into main with 167 additions and 35 deletions across 20 files.
qwen3.6-35b-a3b-mtp-q6 — — Merged into main, migrating linters to ruff. A dedicated ruff.toml manages legacy configuration. The update maintains 100% diff coverage with no overall coverage change, building on PR #4011.

Update history

No update history recorded yet.

Related work

  • Related To: snapcore/snapcraft#4011 (confidence 95%)

    Dependency update PR whose changes were included as the first commit of this branch (commit 42b868319)

  • Related To: canonical/craft-parts#337 (confidence 92%)

    Upstream PR in craft-parts by Alex that the pyproject.toml Ruff configuration was ported from

Related issues

Issue Project State Summary Similarity
#337 Linters: migrate from flake8 to ruff craft-parts merged Merged PR #337 in commit 487e049f, making Ruff the default linter while retaining flake8 through the optional make test-flake8 target.
83%
#33 lint: fix lint issues with newer ruff craft-archives merged PR #33 merged as commit c2a6687, fixing new lint failures introduced by a newer Ruff release across3 files (+5/-3). Maintainer deferred extra unit tests to CRAFT-1641.
81%
#349 linters: fix new ruff issues craft-parts merged Merged in canonical/craft-parts#349 at commit eabd0bca, allowing temporary-directory paths in tests and marking SHA-1 use as non-security for newer Ruff releases.
79%
#932 feat: replace flake8 + plugins and isort with ruff charmcraft merged Merged PR #932 (commit ac847a31, branch ruff-in-template) replaced flake8 + plugins and isort with Ruff in charmcraft, cutting the lint dependency tree and CI instability from flake8 plugin breakage.
79%
#146 style: fix linting errors for ruff 0.12 craft-platforms merged PR #146 merged in craft-platforms (commit fdad4a1) to fix ruff 0.12 lint errors: added # noqa: PLC0415 to lazy import in tests/conftest.py and ignored PLW1641 (eq-without-hash) in pyproject.toml.
77%
#29 style(lint): fix ruff 0.6.0 linting errors craft-platforms merged Merged PR #29 as commit 399c4e0, fixing Ruff 0.6.0 lint errors and switching the pre-commit Ruff hook to rolling versions.
76%
#580 style(ruff): fix linting issues from ruff update craft-application merged Merged PR canonical/craft-application#580 (commit 97347705) by lengau applied style-only fixes (+7/-7, 3 files) for new lint failures caused by a Ruff update; approved by 3 reviewers.
76%
#1662 style(lint): auto-fix with ruff craft-parts merged Merged Ruff auto-fixes across six files after maintainer review; canonical/craft-parts#1662 landed as commit 2be2b462 (+80/-58).
76%
#624 style(lint): fix ruff 0.6.0 linting errors craft-providers merged Merged as commit 823622d, fixing Ruff 0.6.0 lint errors and switching the pre-commit Ruff hook to rolling versions.
75%
#68 lint: update ruff and fix linting craft-archives merged Merged PR #68 as commit 8bb81ae, updating Ruff and fixing lint violations across four files after prerequisite #67.
75%