Documentation

This documentation will help you use PrettyCI. In case you do not find the answer to your question feel free to get in touch.


How it works

By default PrettyCI uses PHP CodeSniffer to validate your code against the PSR-2 coding standard. PSR-2 is the most widespread code formatting standard in PHP and is a very good default to start with.

You can however customize things further. PrettyCI will automatically detect configuration files in your repository and run the appropriate tool:

Since PrettyCI supports open source tools, that means you can run the same analysis on your machine and on PrettyCI. You are never locked-in with us or a specific tool or standard.

In case you are interested, PrettyCI actually runs the pretty CLI command, which is a wrapper around CodeSniffer and PHP-CS-Fixer. That CLI tool is open source, you can install in on your machine and simply run pretty instead of figuring out all the options of CodeSniffer or PHP-CS-Fixer.

Using a custom standard

If you are using a custom coding standard that is installed through a Composer dependencies, you need to know that PrettyCI does not run composer install before running an analysis. The reason for that is that it is a massive waste of time and resources for most repositories that do not need Composer dependencies, and that it would mean installing private dependencies for private projects too.

PrettyCI provides an alternative solution to install a coding standard as a dependency: you can create a separate .prettyci.composer.json file that PrettyCI's composer will use.

For example if you wanted to use Doctrine's coding standard you can create a .prettyci.composer.json file containing:

{
    "require-dev": {
        "doctrine/coding-standard": "^4.0.0"
    }
}

And a phpcs.xml file referencing this standard:

<?xml version="1.0"?>
<ruleset>
    <rule ref="vendor/doctrine/coding-standard/lib/Doctrine/ruleset.xml"></rule>
    <file>src</file>
</ruleset>

The phpcs.xml is the official phpcs configuration file, you can simply run phpcs locally and things will work! Do not forget to also add "doctrine/coding-standard": "^4.0.0" to your main composer.json.

Timeouts

Analyses are limited to 3 minutes on PrettyCI which should be plenty enough. Please keep in mind that in order to offer the best privacy and security no cache is kept between analyses.

If you use a custom coding standard that is installed through Composer (see the section above) then Composer has an additionnal timeout of 1 minute. Try to install only the strict minimum in .prettyci.composer.json.

In case those timeouts are too short for your use case please feel free to contact us.