Giter VIP home page Giter VIP logo

deprecation-detector's Introduction

SensioLabs DeprecationDetector

Build Status

The SensioLabs DeprecationDetector runs a static code analysis against your project's source code to find usages of deprecated methods, classes and interfaces. For Symfony2 projects, it also detects usages of deprecated services. It identifies the use of deprecated code thanks to the @deprecated annotation.

Disclaimer

Please note this tool is in a very early stage of development. Expect bugs and quirks.

Basic knowledge

The Sensiolabs DeprecationDetector is a command line command based on the Symfony2 console component. It makes heavy use of the PHP-Parser library for analyzing PHP code.

The command works in three steps:

  1. Scanning your vendor libraries for defined deprecations and cache them as a ruleset
  2. Finding usages of those deprecations from your ruleset.
  3. Output with the affected code parts.

Installation

Standalone installation

Clone the repository

$ git clone [email protected]:sensiolabs-de/deprecation-detector.git

Run composer

$ composer install

Create phar archive with Box (optional)

$ box build

If you want to call the deprecation-detector globally, it needs to be placed in your PATH. For example with:

$ sudo chmod a+x deprecation-detector.phar
$ sudo mv deprecation-detector.phar /usr/local/bin/deprecation-detector

Usage

Assuming you are in a Symfony2 project, simply run:

$ deprecation-detector check

(The check command name can be ommitted, if you do not provide arguments or options.)

To use the DeprecationDetector in a non-Symfony2 project, you need to provide the source and the ruleset arguments

$ deprecation-detector check src/ vendor/
$ deprecation-detector check src/ composer.lock
$ deprecation-detector check src/ .rules/some_generated_rule_set

You can get a list of all options and arguments by running

$ deprecation-detector check --help

Excluding deprecated method calls

You can exclude deprecated method calls by using the filter-method-calls option. This option takes a comma separated list of method references to exclude.

$ deprecation-detector check --filter-method-calls=MyClass::method,Foo::bar src/ vendor/

This will exclude all deprecated calls to MyClass::method and Foo::bar.

Contribution

Currently, the SensioLabs DeprecationDetector is in a very early state. Pull requests are welcome!

Maintainers

The DeprecationDetector is a project developed by the team at SensioLabs Deutschland, maintained by @marvin_klemp.

deprecation-detector's People

Contributors

bestform avatar chr-hertel avatar derrabus avatar drschimke avatar marvinklemp avatar mikesimonson avatar oskarstark avatar rnuernberg avatar skug avatar slde-robin avatar stof avatar umulmrum avatar xabbuh avatar

Watchers

 avatar

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.