Skip to content

style: reformat with ruff - #227

Merged
uniqueg merged 1 commit into
devfrom
style/ruff-format
Oct 22, 2026
Merged

uniqueg merged 1 commit into
devfrom
style/ruff-format

Conversation

@uniqueg

@uniqueg uniqueg commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Part 1 of #206 (refs, does not close it). This PR only reformats. The second PR adopts the shared ruff rules, strict mypy and pre-commit, and lists this PR's squash commit in .git-blame-ignore-revs. FOCA did the same in two PRs (elixir-cloud-aai/foca#353, then elixir-cloud-aai/foca#358). With squash merges, the reformat needs its own commit on dev before git blame can ignore it.

Changes:

  • ruff format (line length 88, target-version = "py310") on all Python code, including tests/unitTest.
  • Trailing whitespace stripped and one final newline added, as the pre-commit hooks will require. This covers deployment files and pro_tes/api/middleware_management.yaml.
  • Left out:
    • The vendored GA4GH specifications, which are kept as published.
    • README.md, docs/** and the community files, which the docs work handles.
  • flake8 accepts ruff format's line length and slice spacing (.flake8) until style: adopt the shared ruff, mypy and pre-commit #206 replaces flake8. One pylint disable comment moved to the line it belongs to, after the reformat split the signature.

Light lane: formatting only, no logic changes; verified with the existing linters and tests below.

How it was verified

  • ruff format --check .: all files formatted.
  • flake8 pro_tes: clean. pylint pro_tes: 10.00/10. mypy pro_tes: no issues.
  • pytest tests --ignore=tests/unitTest --ignore=tests/test_integration: 41 passed.

Declined review findings

None.

Open questions

None.

🤖 Generated with Claude Code

Summary by Sourcery

Apply consistent Ruff formatting and whitespace normalization without changing application behavior.

Enhancements:

  • Reformat Python source and tests with Ruff for consistent styling and an 88-character line length.
  • Normalize whitespace and final newlines across deployment manifests and API documentation files.

Build:

  • Add Ruff formatting configuration targeting Python 3.10 and align Flake8 line-length and slice-spacing settings.

Chores:

  • Preserve vendored specifications and documentation-scope files outside the automated reformatting.

Format all Python code with ruff format, line length 88, as in
cloud-registry and FOCA; strip trailing whitespace and end files with
one newline, as the pre-commit hooks of the shared standard will
require. Only formatting changes, so that the commit can be ignored by
git blame; the shared lint rules, strict mypy and pre-commit follow
separately. Vendored GA4GH specifications are kept as published; the
README, docs and community files are left to the docs work. flake8
accepts the line length and slice spacing of ruff format until ruff
replaces it.

Refs #206

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

This formatting-only PR introduces the Ruff formatter configuration and applies it across Python sources and tests, while normalizing whitespace/newlines in selected deployment and API files and updating flake8 compatibility settings; no intentional runtime or API behavior changes are included.

File-Level Changes

Change Details Files
Applied Ruff formatting consistently across the Python codebase, including production code and unit tests.
  • Configured Ruff with an 88-character line length and Python 3.10 target.
  • Reflowed calls, literals, comprehensions, strings, signatures, imports, and context managers without intended logic changes.
  • Adjusted the pylint disable placement where formatting split a function signature.
pyproject.toml
pro_tes/ga4gh/tes/models.py
pro_tes/ga4gh/tes/server.py
pro_tes/ga4gh/tes/task_runs.py
pro_tes/middleware/middleware_handler.py
pro_tes/plugins/middlewares/task_distribution/distance.py
pro_tes/utils/db.py
tests/conftest.py
tests/test_app.py
tests/test_integration/test_endpoints.py
tests/test_models.py
tests/test_tasks.py
tests/unitTest/mock_data.py
tests/unitTest/pro_tes/endpoints/test_endpoints.py
tests/unitTest/pro_tes/middleware/mock_data.py
tests/unitTest/pro_tes/middleware/test_distance_based_middleware.py
Aligned existing lint configuration with Ruff's formatting output.
  • Permitted Ruff's line length and slice-spacing conventions in flake8 until the planned lint-rule migration.
.flake8
Normalized whitespace and newline formatting in deployment and API specification files.
  • Removed trailing whitespace and ensured final newlines where missing.
  • Preserved the content and behavior of Helm templates and API descriptions.
deployment/README.md
deployment/templates/flower/flower-ingress.yaml
deployment/templates/mongodb/mongodb-pvc.yaml
deployment/templates/mongodb/mongodb-secret.yaml
deployment/templates/protes/protes-ingress.yaml
deployment/templates/protes/protes-volume.yaml
deployment/templates/rabbitmq/rabbitmq-pvc.yaml
pro_tes/api/middleware_management.yaml

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@uniqueg
uniqueg marked this pull request as ready for review October 22, 2026 19:22

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@uniqueg
uniqueg merged commit cc893a7 into dev Oct 22, 2026
10 checks passed
@uniqueg
uniqueg deleted the style/ruff-format branch October 22, 2026 19:23
uniqueg added a commit that referenced this pull request Oct 22, 2026
* style: reformat with ruff

Format all Python code with ruff format, line length 88, as in
cloud-registry and FOCA; strip trailing whitespace and end files with
one newline, as the pre-commit hooks of the shared standard will
require. Only formatting changes, so that the commit can be ignored by
git blame; the shared lint rules, strict mypy and pre-commit follow
separately. Vendored GA4GH specifications are kept as published; the
README, docs and community files are left to the docs work. flake8
accepts the line length and slice spacing of ruff format until ruff
replaces it.

Refs #206

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* style: adopt the shared ruff, mypy and pre-commit

Adopt the standard shared by FOCA and FOCA apps, as in cloud-registry:
ruff with the rule set B C4 D E F G I PL RUF S SIM UP W and Google
docstrings everywhere; strict mypy (disallow_untyped_defs,
disallow_any_generics, warn_unused_ignores) over pro_tes and tests;
pre-commit with pre-commit-hooks, ruff, semgrep (Flask debug mode,
unverified JWTs), gitleaks, actionlint, ast-grep (untyped FOCA config
access, Pydantic v1 dict(), string status codes) and mypy. Remove
flake8, pylint and their settings.

Fix the findings: lazy logging arguments, explicit errors instead of
asserts in app code, request timeouts in the integration tests,
docstrings of the TES models, complete type hints. get_task() had the
type str as the default of its task identifier.

tests/unitTest is excluded until #207 fixes or removes it.

List the reformat (#227) in .git-blame-ignore-revs, and fix the file
ends and trailing whitespace of docs/middleware.md and
docs/images/overview.svg, which the reformat left to the docs work.

CI runs pre-commit in one "Static code analysis" job; actions are
pinned to commits, runs of a pull request are cancelled when superseded,
and jobs have timeouts.

Closes #206
Closes #116

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* style: remove pylint comments

pylint is replaced by ruff, whose PL rules need none of the
suppressions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix: address review of the shared standard

Quote $GITHUB_ENV, which shellcheck (via actionlint) flags on the
runners. A request whose JSON body the middlewares removed is a server
fault (MiddlewareException, 500), not a bad request. Tasks without logs
fail loudly again when the forward is recorded, instead of the forward
being dropped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: document errors for tasks without logs

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs: describe the pre-commit checks

Replace flake8 and pylint in the development docs with the pre-commit
workflow, as in cloud-registry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

1 participant