Skip to content

The generated ruff config selects DTZ and ANN and then ignores both families #7

Description

@AlexeyShalaev

Generated a fresh project from the template today (copier copy --defaults, 41 files, make check and make test green in under three seconds) and read the linting configuration it produced:

[tool.ruff.lint]
select = ["F", "E", "W", "I", "B", "N", "S", "C4", "DTZ", "SIM", "TRY", "PERF", "RUF", "UP", "ANN", "T20", "PTH", "PLC", "PLE", "PLW"]
ignore = ["TRY003", "S101", "ANN401", "RUF012", "S104", "S105", "S106", "ANN204", "DTZ", "ANN", "N802", "PERF401", "SIM105", "S607"]

DTZ and ANN appear in both lists. Selecting a family and then ignoring the whole family is dead configuration: the two entries in ignore cancel two entries in select, and the more specific ANN401 / ANN204 next to them are then pointless too. Anyone reading this file — a contributor, an assistant, the person copying it into a new repo — reads a select list that promises checks the config does not run.

The two families are not equally missed. Annotations are still enforced, because mypy runs with disallow_untyped_defs = true, so ignoring ANN costs little beyond the confusion. DTZ is not covered by anything else, and it is the family that catches datetime.now() without a timezone, datetime.utcnow(), and naive fromtimestamp — in a set of libraries where deadlines, retention windows, partition boundaries and idempotency TTLs are all computed from timestamps. That is the rule family this org can least afford to have switched off by accident.

Every library generated from the template carries the same two lines (deadline-budget, clientwright, servicewright all have them verbatim; pg-partsmith has since diverged to its own configuration), so whatever is decided here should propagate.

What I think it needs:

  • Drop DTZ and ANN from ignore, keep the specific ANN401 / ANN204 exemptions, and see what the existing libraries report. If DTZ turns up real findings, those are bugs worth their own issues; if it turns up only test fixtures, a per-file-ignores entry for tests/ is the honest way to say so.
  • If a family really is meant to be off, remove it from select too, so the file says what it does.
  • A per-file-ignores block for tests/ is probably the missing piece behind several of these entries (S101 for assert, ANN for fixtures), and it would let the library code keep the stricter rules.

The rest of the generated project is in good shape: pre-commit with fourteen hooks including a conventional-commit check, CI with lint plus unit and integration jobs and an all-checks-passed gate, release-please wired to the version file, a docs site with an agents page, and the Trusted Publishing workflow. The lint config is the one place where what it claims and what it runs disagree.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions