fix: resolve ruff and ty lint findings
Metadata
Current evaluation
Merged to fix ruff and ty lint findings and update ruff config, preparing for the Starbase sync in #440.
Resolution: closed resolved
Reason: The PR was merged, resolving lint failures by fixing code style issues (ruff) and type-checking warnings (ty), and updating the ruff configuration to align with Starbase.
Evaluated by: mr-cal-bot
No scores available.
Issue body
🤖 [BEEP BOOP, A BOT WROTE THIS DESCRIPTION - space-bunny-free, opencode]
Preparation PR for the Starbase sync in #440. Fixes the lint findings that `make lint` reports, so the `lint / files` job passes. #440 stays in draft until this merges.
### Source fixes
| Finding | Where | Fix |
|---|---|---|
| `ICN001` (11) | 14 files | Adopt the `import datetime as dt` alias convention |
| `TC002` | `craft_store/errors.py` | `requests` into a `TYPE_CHECKING` block |
| `TC003` (2) | `craft_store/publisher/_publishergw.py` | `Collection`/`Sequence` into a `TYPE_CHECKING` block |
| `PERF401` | `craft_store/errors.py` | Comprehension in `StoreErrorList.__str__` |
| `RUF100` | `craft_store/creds.py` | Drop a stale `# noqa: ANN401` |
| `ty` (2) | `tests/integration/test_upload.py`, `tests/unit/models/test_track_guardrail_model.py` | Pass fields by name instead of hyphenated alias dicts |
`ICN001` already fires on `main`, so `lint / files` is failing there today; the rest surface once #440 adopts Starbase's expanded `tool.ruff.lint.select`. The `TYPE_CHECKING` moves are safe because both modules use `from __future__ import annotations`. The `ty` fixes are behaviour-identical, since `MarshableModel` sets `populate_by_name = True`.
### Config
Adds `allow-star-arg-any = true` under `[tool.ruff.lint.flake8-annotations]`, the same value `starbase/main` sets at `pyproject.toml:226`. That permits the `**kwargs: Any` forwarder in `DeveloperToken.model_validate_json` (`craft_store/creds.py:211`), which Starbase's expanded select would otherwise flag as `ANN401`. Because it is the upstream value, both sides stay in agreement when #440 lands.
No `tool.ruff.lint.ignore` entries are added.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | closed resolved | Merged to fix ruff and ty lint findings and update ruff config, preparing for the Starbase sync in #440. |
Update history
| Date | Change |
|---|---|
| merged | |
| updated | |
| updated | |
| created |
Related work
-
Related To:
craft-store#440
(confidence 95%)
Preparation PR for the Starbase sync mentioned in the description.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #441 fix: resolve ruff and ty lint findings | craft-store | closed | Merged to fix ruff and ty lint findings (import ordering, type-checking imports, ty model fields) in preparation for the Starbase sync PR #440. | |
| #165 style: fix linting for ruff 0.12 | imagecraft | merged | Merged #165, incorporating canonical/starbase#408, with a four-file Ruff 0.12 compatibility style update (+7/-7). | |
| #588 chore: use the latest ruff config from starbase | craft-application | merged | Merged PR #588 as commit 44b1a940, adopting starbase's latest Ruff configuration and updating linting across 86 files for the Starflow migration. | |
| #55 lint: stricter ruff rules | starbase | merged | Merged PR canonical/starbase#55 as b5cda0d, tightening Ruff lint rules in one file (+23/-9) after maintainer approval. | |
| #1232 tools: update ruff configuration to starbase v1 | charmcraft | merged | Merged charmcraft#1232 in commit c9eb75cd, updating Ruff to Starbase v1 and applying related lint and formatting changes across 64 files. | |
| #4712 Move more linting to ruff | snapcraft | closed | Ruff linting was completed and aligned with Starbase; pylint and isort were removed in #4817 and commit a00f1c439, followed by pylint cleanup in #4848. | |
| #103 chore: fix new lints from ruff 0.12 | craft-grammar | merged | Merged PR #103 as a3ef1dd, updating Ruff to 0.12 and fixing resulting lint errors across four files; cherry-picked from canonical/starbase#409. | |
| #263 tools: add ruff config | rockcraft | merged | Merged PR #263 added Starbase’s Ruff configuration and a Makefile test-ruff target; merged as commit 4abd39c2. | |
| #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. | |
| #803 style: fix linting issues with ruff 0.12 | craft-application | merged | Merged via commit 5e15ff09, fixing Ruff 0.12 lint failures across 14 files. A separate integration-test failure was fixed by #804. |