{"id":13501541,"url":"https://github.com/asottile/dead","last_synced_at":"2025-05-15T04:02:52.197Z","repository":{"id":33970603,"uuid":"164558990","full_name":"asottile/dead","owner":"asottile","description":"dead simple python dead code detection","archived":false,"fork":false,"pushed_at":"2025-03-31T21:00:43.000Z","size":266,"stargazers_count":352,"open_issues_count":1,"forks_count":11,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-07T00:07:43.139Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asottile.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"asottile"}},"created_at":"2019-01-08T04:16:14.000Z","updated_at":"2025-03-31T21:00:46.000Z","dependencies_parsed_at":"2023-10-04T00:53:07.867Z","dependency_job_id":"3ab2775e-e0ee-4965-83fc-1c23b8129a16","html_url":"https://github.com/asottile/dead","commit_stats":{"total_commits":202,"total_committers":7,"mean_commits":"28.857142857142858","dds":"0.40594059405940597","last_synced_commit":"d9e1d089f445d2721087e3476b6c05c917c89642"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asottile%2Fdead","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asottile%2Fdead/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asottile%2Fdead/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asottile%2Fdead/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asottile","download_url":"https://codeload.github.com/asottile/dead/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248819379,"owners_count":21166477,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T22:01:41.040Z","updated_at":"2025-04-14T03:58:31.382Z","avatar_url":"https://github.com/asottile.png","language":"Python","funding_links":["https://github.com/sponsors/asottile"],"categories":["Python","Unused code detection"],"sub_categories":[],"readme":"[![build status](https://github.com/asottile/dead/actions/workflows/main.yml/badge.svg)](https://github.com/asottile/dead/actions/workflows/main.yml)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/asottile/dead/main.svg)](https://results.pre-commit.ci/latest/github/asottile/dead/main)\n\ndead\n====\n\ndead simple python dead code detection\n\n## installation\n\n```bash\npip install dead\n```\n\n\n## cli\n\nConsult the help for the latest usage:\n\n```console\n$ dead --help\nusage: dead [-h] [--files FILES] [--exclude EXCLUDE] [--tests TESTS]\n\noptional arguments:\n  -h, --help         show this help message and exit\n  --files FILES      regex for file inclusion, default: ''\n  --exclude EXCLUDE  regex for file exclusion, default '^$'\n  --tests TESTS      regex to mark files as tests, default\n                     '(^|/)(tests?|testing)/'\n```\n\nrun the `dead` utility from the root of a git repository.\n\n## as a pre-commit hook\n\nSee [pre-commit](https://github.com/pre-commit/pre-commit) for instructions\n\nSample `.pre-commit-config.yaml`:\n\n```yaml\n-   repo: https://github.com/asottile/dead\n    rev: v2.1.0\n    hooks:\n    -   id: dead\n```\n\n### how it works\n\n1. find all files in a repository using `git ls-files` and filtering:\n    - only include files matched by the `--files` regex\n    - exclude files matched by the `--exclude` regex\n    - only include files identified as `python` by\n      [`identify`](https://github.com/chriskuehl/identify)\n    - classify test files by the `--tests` regex\n1. ast parse each file\n    - search for definitions and references\n1. report things which do not have references\n\n### false positives\n\nI wrote this in ~15 minutes on an airplane, it's far from perfect but often\nfinds things.  Here's a few things it's not good at:\n\n- functions which implement an interface are often marked as unused\n- metaclass magic is often marked as unused (enums, model classes, etc.)\n\n### suppressing `dead`\n\nThe `# dead: disable` comment will tell `dead` to ignore\nany line which has reportedly dead code.\n\n### is this project dead?\n\n_maybe._\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasottile%2Fdead","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasottile%2Fdead","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasottile%2Fdead/lists"}