Skip to content

Dead code detection #2829

Open
Open

Description

@MatthewMckee4

vulture does a decent job at this. clippy does an amazing job at this.

We don't want to emit this for 'public' methods. I don't know if we just want to check __all__, or if we want to be more lenient, personally I think an option to say I don't want to export anything, so the rule is very pedantic would be great, and the other side of that is maybe only complaining about 'private' (prefixed with '_') methods that are unused.

Activity

  1. added
    wish
    lint
    on Feb 16, 2026
  2. changed the title [-]Add `dead-code` warning diagnostics[/-] [+]Dead code detection[/+] on Mar 4, 2026
  3. MichaReiser commented on Mar 4, 2026

    @MichaReiser
    Member

    Just writing down some of my thoughts:

    • This is different from Gray out unreachable code #784 in that it zooms out and looks across functions, even at the entire project. E.g., are there functions that are never called?
    • A big challenge with this at the module level is that Python lack's visibility modifier. Especially if the project is a library with external consumers. We also need to consider re-exports.
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

    lintunreachable-codewish

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions