Giter Site home page Giter Site logo

mnapoli / pretty Goto Github PK

View Code? Open in Web Editor NEW
107.0 9.0 5.0 28 KB

✨ CLI command with sane defaults to simplify CodeSniffer and PHP-CS-Fixer

Home Page: https://prettyci.com

License: MIT License

PHP 100.00%
php psr-1 psr-2 coding-standards code-formatter coding-style

pretty's Introduction

A single CLI command with sane defaults to simplify CodeSniffer and PHP-CS-Fixer.


PHP CodeSniffer and PHP-CS-Fixer are powerful but using them is not simple. It is not always obvious which tool a project uses and whether there is a configuration file to use or whether you need to provide options to the CLI command.

Now it's easy, simply run:

pretty

Pretty will detect the configuration file that exist in the current directory and will run the correct tool. If no configuration file exist, Pretty will run PHP CodeSniffer with PSR-2 by default.

If errors are found, simply run:

pretty fix

Again, Pretty will run the appropriate tool (php-cs-fixer or phpcbf) to fix as many errors as possible in your code.

Installation

If you have already set up a global install of Composer just run:

composer global require mnapoli/pretty

Pretty comes with no dependencies so it should not bring any conflict in Composer.

You can also install it as a local dependency of your project with composer require --dev mnapoli/pretty. In that case you can start the tool with vendor/bin/pretty.

You will be able to update to new versions by running:

composer global update mnapoli/pretty

Usage

Running an analysis is as simple as running:

pretty

This command will not change any code. To fix errors reported by this command, simply run:

pretty fix

In case you are running the analyses in CI you might want to run:

pretty ci

This will disable the caching option of PHP-CS-Fixer or CodeSniffer (because the cache will not be kept in CI).

Hosted continuous integration

If you are using pretty in your daily development workflow you may be interested in PrettyCI.com, the SaaS version of pretty.

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.