Skip to content

const: the four AppType registries carry a stale consider-using-f-string disable with zero %-format sites #809

Description

@JarryShaw

Describe the bug

The four generated AppType registries each carry # pylint: disable=consider-using-f-string while containing zero %-format sites, so the suppression is stale. Found by #803's cross-review, confirmed genuinely stale with pylint's useless-suppression rather than inferred from a grep.

pcapkit/const/reg/apptype/tcp.py     %-format sites = 0   disable present
pcapkit/const/reg/apptype/udp.py     %-format sites = 0   disable present
pcapkit/const/reg/apptype/sctp.py    %-format sites = 0   disable present
pcapkit/const/reg/apptype/dccp.py    %-format sites = 0   disable present

Expected behavior

The disable dropped from all four, and from whatever emits it, so the suppression is earned everywhere in this family.

Additional context

The source is the fifth template, which #803 deliberately did not touch. TRANSPORT at pcapkit/vendor/reg/apptype/apptype.py:504 emits the four registry modules; #803's title scopes to "the four bespoke templates" and this is a fifth. So this is not a #803 regression — the disable is identically stale on main — it is the remainder of #798's "the disable being earned is the cheapest signal the work is unfinished" argument, applied one template further out.

make pylint cannot see this. useless-suppression is not in the Makefile's --enable set, so the staleness is invisible to CI and will stay invisible after this is fixed. Worth deciding whether to add it while here — that would catch the next stale disable for free, and it is the check that found this one.

Two traps, both hit while establishing this:

  • A %-format grep must allow both quote styles and multi-line strings. A pattern requiring single quotes reported 0 for files whose every site was double-quoted. The review used an AST walk over BinOp(Constant(str) % x) and self-tested it against known positives including a double-quoted and a triple-quoted case.
  • pylint --disable=all --enable=useless-suppression manufactures false hits — the review's first run produced bogus line-too-long/no-member reports that way. Use the real Makefile flag set plus useless-suppression.

Related: #798, #803, #804, #783.

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

    constRegenerated IANA or vendor constant tables; members keep their numeric valuesrefactorRestructuring for its own sake — neither a fix nor a new capability (refactor: prefix)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions