Skip to content

Pin ruff version and add explicit lint rule selection for docs - #9906

Merged
timosachsenberg merged 2 commits into
developfrom
claude/ruff-version-compat-c1nyih
Aug 20, 2026
Merged

timosachsenberg merged 2 commits into
developfrom
claude/ruff-version-compat-c1nyih

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR fixes the doc-validate workflow to be resilient to ruff version changes. The issue (#9899) occurred when ruff 0.16 widened its default lint rule selection from 59 to 413 rules, causing the unpinned astral-sh/ruff-action to suddenly fail with no code changes.

Changes:

  1. Added doc/pyopenms/ruff.toml: Explicitly selects the lint rules that the documentation sources were written against (ruff's pre-0.16 default: E4/E7/E9/F) plus all currently clean rule groups. This makes the lint result independent of ruff version changes.

  2. Updated .github/workflows/doc-validate.yml:

    • Pinned astral-sh/ruff-action to version 0.16.2 to prevent unexpected formatter style changes
    • Added explanatory comments about why both the action version and the ruff.toml configuration need to be pinned and updated together
    • Reformatted the action configuration for clarity

The configuration deliberately excludes rules that conflict with the teaching/example nature of the documentation (T20, N, ARG, RUF, UP, BLE, SIM, B, PTH, DTZ, S) and omits Q (flake8-quotes) as it conflicts with ruff's formatter.

Checklist

  • Changes are documentation/workflow configuration only (no code changes requiring AUTHORS/CHANGELOG updates)
  • No new tests needed (workflow configuration change)
  • Verified configuration is clean on ruff 0.15.9 and 0.16.2

https://claude.ai/code/session_01SKka5hGu2GB4e5Yw1fWhsd

Summary by CodeRabbit

  • Documentation
    • Improved documentation quality checks with consistent Ruff formatting and linting settings.
    • Added explicit guidance for maintaining formatter and linting version pins.
    • Configured documentation sources for reliable validation across environments.

claude added 2 commits August 12, 2026 09:46
…es (#9899)

The build-sphinx job has been red on every doc PR since 2026-07-25 with no
commit in this repository causing it. `astral-sh/ruff-action` was unpinned, so
CI installed whatever ruff was current, and ruff 0.16 widened its *default*
lint selection from 59 rules to 413. Against that wider default the
documentation sources report 35 pre-existing style findings; under the old
default they report none.

Fix the reproducibility problem rather than the findings:

- Add doc/pyopenms/ruff.toml selecting E4, E7, E9 and F explicitly. This is
  byte-for-byte the pre-0.16 default set (verified: ruff 0.16.2 with this file
  enables exactly the same 59 rules that ruff 0.15.9 enabled by default), so it
  is a no-op for the current tree while making the lint result independent of
  the installed ruff version. `ruff check doc/pyopenms` now passes on 0.13.3,
  0.14.14, 0.15.9, 0.16.0 and 0.16.2 alike.

- Pin the action's ruff version. The formatter has its own version-dependent
  style -- ruff <= 0.14 wants a blank line after a function signature removed
  where 0.15+ keeps it -- so `ruff format --check` needs a pinned tool even
  though the rule selection is now explicit.

Whether to adopt more of the modern rule set stays a separate decision; none of
the 35 findings is a functional bug.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SKka5hGu2GB4e5Yw1fWhsd
…ready clean

The previous commit froze the selection at ruff's pre-0.16 default (59 rules)
purely to make CI reproducible. That left a lot of useful linting on the table
for no reason, so select every additional rule group that reports zero findings
against the tree as it stands: ASYNC, C4, EXE, FA, FLY, INT, ISC, LOG, PERF,
PGH, PIE, PT, PYI, RET, TRY, W and YTT.

This takes the enabled set from 59 rules to 246 while remaining a no-op for
every Python file -- no source change accompanies it, and `ruff check
doc/pyopenms` passes unchanged on 0.13.3, 0.14.14, 0.15.9, 0.16.0 and 0.16.2.

Two exceptions, both because ruff documents them as conflicting with its own
formatter (https://docs.astral.sh/ruff/formatter/):

- W191 and ISC002 are selected via their prefixes but explicitly ignored.
- Q (flake8-quotes) is left out altogether rather than ignored, since the
  documented conflicts Q000-Q004 are essentially the whole group and the
  formatter already normalises quote style.

The groups that would require touching the sources stay unselected and are
listed in ruff.toml with their finding counts, so the follow-up decision from
#9899 keeps its evidence next to the config. The largest of them argue against
themselves: T20 flags 26 `print()` calls in scripts whose purpose is to print,
and ARG flags 14 unused arguments in Sphinx extension callbacks whose
signatures are fixed by Sphinx.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SKka5hGu2GB4e5Yw1fWhsd
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b45a6a95-34a4-4a82-91cb-1d9d83e804e8

📥 Commits

Reviewing files that changed from the base of the PR and between ffc7131 and eb8ec61.

📒 Files selected for processing (2)
  • .github/workflows/doc-validate.yml
  • doc/pyopenms/ruff.toml

📝 Walkthrough

Walkthrough

Changes

Ruff documentation validation

Layer / File(s) Summary
Ruff version and rule configuration
.github/workflows/doc-validate.yml, doc/pyopenms/ruff.toml
The workflow targets doc/pyopenms and pins Ruff to 0.16.2. The new configuration defines explicit lint rules and ignores W191 and ISC002.

Possibly related issues

Poem

A rabbit checks each line with care,
While Ruff rules settle in the lair.
The formatter holds steady too,
With pins precise and paths in view.
“Clean docs!” the bright ears cheer.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes pinning Ruff and adding explicit lint rules for documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/ruff-version-compat-c1nyih

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Makes pyOpenMS documentation linting reproducible across Ruff releases.

Changes:

  • Adds explicit documentation lint-rule selection.
  • Pins Ruff 0.16.2 in the documentation workflow.
  • Documents maintenance rationale and formatter conflicts.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
doc/pyopenms/ruff.toml Defines stable lint rules and formatter-compatible exclusions.
.github/workflows/doc-validate.yml Pins Ruff and clarifies workflow configuration.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@timosachsenberg
timosachsenberg merged commit 11bc647 into develop Aug 20, 2026
37 checks passed
@timosachsenberg
timosachsenberg deleted the claude/ruff-version-compat-c1nyih branch August 20, 2026 06:19
timosachsenberg added a commit that referenced this pull request Aug 22, 2026
…e fix (#9942)

Documents three merged CI-reliability PRs that were missing changelog
entries: the ccache build-cache save/restore split (#9887), pinning
ruff for doc-validate (#9906), and the Windows nightly test race in
TOPP_OpenSwathWorkflow_17_cache (#9937).

Co-authored-by: Claude <[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.

3 participants