mardi 25 février 2020

Lancer phpcs localement et via CircleCI

Pour utiliser steevanb/php-code-sniffs dans vos projets, et pouvoir le lancer localement + via CircleCI, voilà un exemple :

bin/phpcs

#!/usr/bin/env sh set -e if [ $(which docker || false) ]; then readonly PROJECT_DIRECTORY=$(realpath $(dirname $(realpath $0))/..) docker run \ --rm \ -v ${PROJECT_DIRECTORY}:/var/repository:ro \ --entrypoint=/var/repository/bin/phpcs \ steevanb/php-code-sniffs:3.0.1 else /var/steevanb/php-code-sniffs/vendor/bin/phpcs \ --warning-severity=0 \ --ignore=/var/repository/vendor/ \ --standard=/var/steevanb/php-code-sniffs/vendor/steevanb/php-code-sniffs/Steevanb/ruleset.xml \ --bootstrap=/var/repository/phpcs.bootstrap.php \ --report=steevanb\\PhpCodeSniffs\\Reports\\Steevanb \ /var/repository fi

.circleci/config.yml

version: '2.1' jobs: phpcs: docker: - image: steevanb/php-code-sniffs:3.0.1 working_directory: /var/repository steps: - checkout - run: name: phpcs command: bin/phpcs workflows: version: '2.1' CI: jobs: - phpcs

Aucun commentaire:

Publier un commentaire