Skip to content

style: lint and format src/djehuty/web/ui.py with ruff, enforce - #185

Draft
641e16 wants to merge 9 commits into
4TUResearchData:mainfrom
641e16:wip-lint-66-147-ruff-web-ui
Draft

style: lint and format src/djehuty/web/ui.py with ruff, enforce#185
641e16 wants to merge 9 commits into
4TUResearchData:mainfrom
641e16:wip-lint-66-147-ruff-web-ui

Conversation

@641e16

@641e16 641e16 commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

Note: Stacked on #173 - only the last two commits are new here;
I'll rebase onto main once #173 merges.

Summary

Next slice of the incremental Ruff rollout (#66): lints and formats src/djehuty/web/ui.py and adds it to the enforced scope. Split into a mechanical commit (pure ruff check --fix + ruff format output, safe to skim) and a manual commit (the changes that required judgment, worth review).

Changes

  • src/djehuty/web/ui.py (commit 1, mechanical): apply ruff check --fix and ruff format. No functional changes; all 23 long-line
    violations were resolved by the formatter.
  • src/djehuty/web/ui.py (commit 2, manual): swap the # pylint: disable=unused-import comments for # noqa: F401 on the five optional-dependency availability probes (SAML, pyvips, uwsgi, boto3); rename three module-local exceptions to carry the Error suffix (N818); fix one incorrect docstring (see Notes).
  • justfile: add the file to lint_paths so just lint and CI enforce it.

Approval Checklist

  • I agree to follow Djehuty's code of conduct.
  • I have read and I have follow the code contribution workflow.
  • Code style and conventions were respected.
  • Documentation has been updated where needed (README, docs, or examples).
  • Review approved by at least one maintainer.
  • Merge readiness (PR is squashed into a single commit and follows the commit template).

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)

  • !!! Three exception renames, verified contained: ConfigFileNotFound -> ConfigFileNotFoundError, UnsupportedSAMLProtocol -> UnsupportedSAMLProtocolError,
    DependencyNotAvailable -> DependencyNotAvailableError.
  • All three are defined, raised, and caught inside ui.py (verified by grep), so nothing outside this file is affected.
  • The five "unused" imports are deliberate availability probes (try/except import setting *_DEPENDENCY_LOADED flags). Ruff correctly refuses to auto-remove them; the pylint suppression comments were replaced with # noqa: F401 -- availability probe, since Ruff supersedes pylint now.
  • While renaming, I found 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 builtin FileNotFoundError). The name is therefore still slightly misleading -> InvalidConfigurationFileError would 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.
  • Verified: just lint green on the full scope; module imports cleanly; unit tests 157/157

641e16 added 9 commits July 14, 2026 12:59
* 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

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 41.20879% with 321 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.49%. Comparing base (1a4ecd1) to head (06be54b).

Files with missing lines Patch % Lines
src/djehuty/web/ui.py 40.05% 231 Missing and 7 partials ⚠️
src/djehuty/utils/convenience.py 33.33% 56 Missing and 2 partials ⚠️
src/djehuty/utils/rdf.py 56.89% 23 Missing and 2 partials ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[IMPROVEMENT]: Lint src/djehuty/web/ui.py

1 participant