Giter Club home page Giter Club logo

pytest-vulture's Introduction

pytest vulture

Run vulture (https://pypi.org/project/vulture/) with pytest to find dead code.

Sample Usage

py.test --vulture

would be the most simple usage and would run vulture for all error messages.

py.test --vulture --vulture-cfg-file=/test/vulture.ini

This would use the vulture with the /test/vulture.ini config path

Ignoring vulture messages in source code

  • ignoring lines :
def test():
    a = 2    # vulture: ignore
  • ignoring methods :
def test():  # vulture: ignore
    pass
  • ignoring classes :
class Test:  # vulture: ignore
    pass

Config file

The config file (the path can be defined by the --vulture-cfg-file option) can look like this

[vulture]
# completely exclude files for vulture
exclude =
    */test/* # We usualy exclude tests because tests can cover dead code

# those file are ignored by pytest, but still computed by vulture
ignore =
    src/toto.py

# ignoring names in code
ignore-names =
    delimiter

# ignoring decorators
ignore-decorators =
  @application.errorhandler
  @application.route
  @celery_app.task
  @application.app.errorhandler

# ignore vulture type of messages
ignore-types =
    attribute
    variable

Acknowledgements

This code depends on vulture

Development

If you want to help development, there is overview documentation in DEVELOPMENT.rst.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Releases

2.0.2

  • Uses vulture with pytest (tested with python 3.7 3.8 and 3.9, with vulture==2.3 and pytest 7.x)

1.0.0

  • stable Gatewatcher internal use only

0.x

  • unstable Gatewatcher internal use only

pytest-vulture's People

Contributors

amaym0n avatar moranabadiegatewatcher avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

amaym0n

pytest-vulture's Issues

Doesn't work with BOM

If any file in your project contains BOM you will get this error "SyntaxError: invalid non-printable character U+FEFF"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.