Giter Site home page Giter Site logo

cludearg's Introduction

fabiang/cludearg

Normalizer library for command line arguments for in- or exclude paths and files

Build Status Scrutinizer Code Quality Code Coverage SensioLabsInsight Dependency Status Latest Stable Version License

When running code checks against your code (manually or automatically via continues integration) you'll have to define paths/files that should (includes) and paths/files that shouldn't (excludes) be checked by the various applications.

The problem is that all those tools define the command-line arguments in a different way. This library instead accepts only a standardized format and can return the application-format for a given application name and version.

SUPPORTED APPLICATIONS

  • php/lint (php -l)
  • squizlabs/php_codesniffer
  • phpmd/phpmd
  • phpdocumentor/phpdocumentor
  • pdepend/pdepend
  • sebastian/phpcpd

INSTALLATION

New to Composer? Read the introduction. Add the following to your composer file:

{
    "require": {
        "fabiang/cludearg": "1.0.x-dev as 1.0.0"
    }
}

USAGE

You'll only need one method:

Fabiang\Cludearg\Cludearg::getArgument(
    string $application,
    string $version,
    array $include,
    array $exclude,
    string $path
)

Example:

use Fabiang\Cludearg\Cludearg;

$cludearg = new Cludearg();

$arguments = $cludearg->getArgument(
    'squizlabs/php_codesniffer',
    '1.0.1',
    array('bin/foo.php', 'src'), // files and folders to be included
    array('vendor', 'tests'), // files and folders to be excluded
    '/myproject' // path where the project can be found
);

All paths for in- and exclude must be relative to the given path. The constructor of Cludearg can optionally take an Definition object, which allows you to add your own definition of arguments.

SYSTEM REQUIREMENTS

  • PHP >=5.3
  • seld/jsonlint >= 1.1

LICENSE

BSD-2-Clause. See the LICENSE.

CONTRIBUTING

Contributing is easy, just make sure the tests are running:

./vendor/bin/phpunit -c tests

If you change the default definition file check if the json schema validates:

./vendor/bin/validate-json definition.json schema/cludearg.json

Also Jsonlint may help you to find errors in the definition file:

./vendor/bin/jsonlint definition.json

cludearg's People

Contributors

fabiang avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.