style: lint and format src/djehuty/web/ui.py with ruff, enforce - #185
Draft
641e16 wants to merge 9 commits into
Draft
style: lint and format src/djehuty/web/ui.py with ruff, enforce#185641e16 wants to merge 9 commits into
641e16 wants to merge 9 commits into
Conversation
* pyproject.toml: Add [tool.ruff] config (line-length 100; E, W, F, I, N, B rule sets) and a "lint" dependency group with ruff, so CI and local runs use the same version. * uv.lock: Lock ruff 0.15.21; refresh stale djehuty version (26.3.1 -> 26.3.3).
* justfile: add lint paths to enforce scope and add lint recipe
* constants.py, convenience.py, rdf.py: Apply "ruff check --fix" (import sorting, not-in comparison) and "ruff format"; wrap remaining long lines. no functional changes.
* .github/workflows/lint.yml: Add reusable workflow that runs "just lint" (ruff check + format check) via uv. * .github/workflows/ci.yml: Wire in the lint job, running in parallel with build and unit tests for fast feedback.
* justfile: ruff lives in the "lint" dependency group, not "dev", so "uv run --group dev ruff" fails on a fresh environment like CI.
* README.md: Add Linting section describing the incremental rollout and the just lint recipe. * CONTRIBUTING.md: State the enforced line length (100) and add a lint step to the code conventions.
* ui.py: Mechanical pass only ("ruff check --fix" and "ruff format").
No functional changes; the remaining violations are resolved in the
next commit.
…Replace pylint directives with "noqa: F401" on the five optional-dependency availability probes; rename three exceptions to carry the Error suffix (N818): all are defined, raised, and caught only within this module; correct the ConfigFileNotFoundError docstring, which described the database instead of the configuration file. * justfile: Add src/djehuty/web/ui.py to lint_paths.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #185 +/- ##
=======================================
Coverage 17.49% 17.49%
=======================================
Files 21 21
Lines 10217 10217
Branches 1977 1977
=======================================
Hits 1787 1787
Misses 8241 8241
Partials 189 189 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Next slice of the incremental Ruff rollout (#66): lints and formats
src/djehuty/web/ui.pyand adds it to the enforced scope. Split into a mechanical commit (pureruff check --fix+ruff formatoutput, safe to skim) and a manual commit (the changes that required judgment, worth review).Changes
src/djehuty/web/ui.py(commit 1, mechanical): applyruff check --fixandruff format. No functional changes; all 23 long-lineviolations were resolved by the formatter.
src/djehuty/web/ui.py(commit 2, manual): swap the# pylint: disable=unused-importcomments for# noqa: F401on the five optional-dependency availability probes (SAML, pyvips, uwsgi, boto3); rename three module-local exceptions to carry theErrorsuffix (N818); fix one incorrect docstring (see Notes).justfile: add the file tolint_pathssojust lintand CI enforce it.Approval Checklist
Issue Reference
Closes #147 (part of #66)
Screenshots (optional)
Green CI run on my fork with the Lint job covering the extended scope:
https://github.com/641e16/djehuty/actions/runs/29643501215
Notes (optional)
ConfigFileNotFound->ConfigFileNotFoundError,UnsupportedSAMLProtocol->UnsupportedSAMLProtocolError,DependencyNotAvailable->DependencyNotAvailableError.*_DEPENDENCY_LOADEDflags). Ruff correctly refuses to auto-remove them; the pylint suppression comments were replaced with# noqa: F401 -- availability probe, since Ruff supersedes pylint now.ConfigFileNotFoundError's docstring claimed it was about the database being unqueryable ; probably a copy-paste artifact?? It now describes what the code does: the exception fires when a file parses but is not a Djehuty configuration file (actual missing files raise the builtinFileNotFoundError). The name is therefore still slightly misleading ->InvalidConfigurationFileErrorwould be more truthful i think but a rename felt out of scope for a formatting PR. I can still do it here or in a follow-up if preferred.just lintgreen on the full scope; module imports cleanly; unit tests 157/157