Skip to content

Instantly share code, notes, and snippets.

@skwashd
Created June 29, 2016 13:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skwashd/66f10081deedb4de43f721569b710a31 to your computer and use it in GitHub Desktop.
Save skwashd/66f10081deedb4de43f721569b710a31 to your computer and use it in GitHub Desktop.
Incrementally improve your Drupal code
language: php
sudo: false
php:
- 5.6
install:
# Remove xdebug to make composer faster.
- phpenv config-rm xdebug.ini
# add composer's global bin directory to the path
- export PATH="$HOME/.composer/vendor/bin:$PATH"
# Install PHP_CodeSniffer and Drupal config
- composer global require drupal/coder
- phpcs --config-set installed_paths ~/.composer/vendor/drupal/coder/coder_sniffer
before_script:
# This slows things down but it ensures all remote branches are fetched.
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
- git fetch --unshallow
- git fetch origin
script:
# Check code sniffer compliance.
- git diff --name-only origin/master | xargs phpcs --standard=Drupal
# Optional slack notifications.
notifications:
slack:
rooms:
- subdomain:token#channel
@thom8
Copy link

thom8 commented Jun 30, 2016

git diff --name-only origin/master includes paths to files that have been deleted

git diff --name-only origin/master --diff-filter=ACMRTUXB | xargs phpcs --standard=Drupal will filter deleted files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment