Skip to content

Carry the hub_fetch_run.py Ruff Exclude to Every Site That Copies or Lints It #4263

Closed

Description

@ptr727

Problem

The pre-commit snippet now tells a repository running ruff under its own config to exclude the carried hub_fetch_run.py, with extend-exclude and force-exclude = true. The other places that copy the helper, or run ruff over a tree holding it, carry no such line:

  • catalog/snippets/husky/pre-commit runs uv run ruff over the whole tree.
  • RESYNC.md step 6 copies the helper.
  • STANDUP.md "Wire a local commit hook" copies it.
  • The VS Code Lint tasks run ruff over the tree.

Take a repository whose own ruff config is stricter than the hub's, for example select = ["E", "W", "F", "RUF"] with line-length = 120. A Husky.Net or tasks-only setup then fails ruff check . on the helper, and an autofix rewrites it so it is no longer byte-identical to the snippet.

The pre-commit README's new sentence is also scoped to a repository "whose own ruff config applies". A repository with no ruff config still lints the helper at ruff's defaults, so that qualifier reads as an exemption it is not.

Done when

Every place that copies the helper or runs ruff over a tree holding it states the exclude, or points at the one sentence that does. The pre-commit README's wording covers a repository with no ruff config of its own.

Found by the local strict review passes on the pre-commit snippet fix.

Activity

  1. added
    pre-existing
    on Nov 17, 2026
  2. ptr727 commented on Nov 17, 2026

    @ptr727
    OwnerAuthor

    One more layout, raised by Copilot on promotion #4255 and routed here by the maintainer on 2026-11-17: a repository whose Python lives only in declared subdirectories, each with its own pyproject.toml, and with no ruff config at the root. The pre-commit snippet runs ruff from the root, so it lints the root hub_fetch_run.py copy under ruff's defaults, and the snippet's exclude has no config file to go in.

    Three candidate homes each break something:

    • A new root pyproject.toml makes python_directories.py resolve the root as a Python directory where nothing is declared.
    • A root ruff.toml is drift under spec/project-types.json python.config.placement.
    • Either one becomes the closest config for a subdirectory project with no [tool.ruff]. Ruff then stops reading that project's requires-python for its target version.

    Settling it needs a decision on where root ruff config may live in that layout, possibly a spec exception. A conformant Python repository with a root pyproject.toml already carries [tool.ruff] there, so the snippet's current guidance covers it.

  3. ptr727 commented on Nov 18, 2026

    @ptr727
    OwnerAuthor

    Decision, 2026-11-18, maintainer's answer: the exclude goes on ruff's command line rather than in any config file.

    The hook snippets and the VS Code Lint tasks call ruff with --extend-exclude hub_fetch_run.py --force-exclude. That covers every layout, the subdirectory-only one with no root ruff config included. It adds no file, so python_directories.py, python.config.placement, and each subdirectory's target-version discovery stay as they are. The accepted trade-off is that a bare ruff check . typed by hand still lints the helper.

    Checked in a scratch layout under ruff 0.17.5, with a stricter-than-default config in effect: without the flags, ruff check . reports the helper. With them, ruff check passes on the directory and on explicit file paths, and ruff format --check skips the helper when it is named explicitly.

    The rejected options were a spec exception for a root ruff.toml and moving the helper out of the root.

  4. added a commit that references this issue on Nov 18, 2026
    4e956a7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pre-existing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions