Skip to content

Ruff configuration disables pyflakes and hides real defects #742

Description

@bschwedler

posit-bakery/pyproject.toml sets [tool.ruff.lint] select = ["T201"]. Ruff's select replaces the default rule set. It does not add to it. Only T201 is active, so every other rule is off. Commit a13d14ff added this setting on 2024-11-22.

This is not a theoretical problem. 80 findings appear when pyflakes is active. Four of them are defects:

  • requires-python = ">=3.10" is wrong. posit_bakery/error.py defines three classes that subclass the builtin ExceptionGroup. That class exists only from Python 3.11 (PEP 654). The metadata permits installation on Python 3.10. The CLI then stops with NameError, because cli/build.py imports error.py. The trove classifiers also advertise Python 3.10.
  • Four tests never ran. A second definition with the same name shadowed each one. One is a parametrized test_build_args with about sixteen cases. A copy of cli_cwd_context also shadowed the cli_tmpcontext fixture.
  • A call to an undefined function passed the lint step. _emit_summary() did not exist. Rule F821 reports it.
  • Nine bare except: clauses in CLI handlers catch BaseException. As a result, a handler catches Ctrl-C and shows it as a command failure.

mypy finds some of these problems. mypy does not run in CI.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdockerRelated to container images we producepythonPull requests that update python codetech debtTechnical debt we should address

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions