Scrutinizer-ci configuring PHP Code Sniffer

288 views Asked by At

Apparently there are two ways to configure scrutinizer-ci to use custom phpCodeSniffer standards. The documentation only mentions phpcs use in "build" node and it isn't clear if they do different things or if one is preferred over the other.

Docs reference: https://scrutinizer-ci.com/docs/tools/php/code-sniffer/

What's the difference between running the checks inside "build" or "checks"? Should I use both?

checks:
    php:
        custom_coding_standard:
            ruleset_path: 'ruleset.xml'    
build:
    tests:
        override:
            - 'phpcs-run --standard=ruleset.xml'
1

There are 1 answers

0
Andrei On BEST ANSWER

The official answer was to use phpcs-run.

build:
    tests:
        override:
            - 'phpcs-run --standard=ruleset.xml'

The phpcs-run wrapper retrieves the latest version of phpcs on every build. Otherwise a preinstalled version of it is used. So usually the best way of running phpcs is using the wrapper in the build section.