# 7.1.1.vulture

* 1.Introduction
  * Vulture is a tool to find **unused code**, **dead code** in Python program
    * 1.It's useful for **cleaning up** and **finding errors** in large code bases.&#x20;
    * 2.Find untested code on library and test suite.&#x20;
  * How does it work?
    * Vulture uses the ast module to build [abstract syntax trees](https://zh.wikipedia.org/wiki/%E6%8A%BD%E8%B1%A1%E8%AA%9E%E6%B3%95%E6%A8%B9) for all given files
    * While traversing all syntax trees it records the names of defined and used objects
*   2.Installation

    ```
      $ pip install vulture  # from PyPI
    ```
* 3.Getting Started
  *   For single file:

      ```
        $ vulture myscript.py
        $ vulture myscript.py --min-confidence 100  # Only report 100% dead code.
      ```
  *   For large project:

      ```
        $ vulture myscript.py mypackage/
      ```
  * example: ![](https://4137043065-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4M0G8A3AbgfgoPuWWW%2F-M4M0INTQnUS90ldtPAg%2F-M4M0NbS62DBwayocdHx%2Ffg.jpg?generation=1586302930949090\&alt=media)
* 4.Reference
  * [https://pypi.python.org/pypi/vulture](https://pypi.python.org/pypi/vulture)
