Skip to content

Instantly share code, notes, and snippets.

@henriqueramos
Created April 25, 2020 10:04
Show Gist options
  • Save henriqueramos/96123033f325fb5ed6513b49e188e1d0 to your computer and use it in GitHub Desktop.
Save henriqueramos/96123033f325fb5ed6513b49e188e1d0 to your computer and use it in GitHub Desktop.
Running PHPCS only on modified files
# There's two commands below.
# The first one its the phpcs CLI, on this, we will use the following parameters
# --extensions=php, --encoding=utf-8, --tab-width=4, -p to show progress of the run, -s to show sniff codes in all reports and -v to print processed files
# The second one its the git diff to display, on this, we will use the following parameters
# --name-only to retrieve only the filenames
# --no-color to remove any ASCII fancy color
# --diff-filter=ACMRTUXB to show only Added, Copied, Modified, Renamed, Type Changed, Unmerged, Unknown and Broke pairing files. More information here: https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---diff-filterACDMRTUXB82308203
vendor/bin/phpcs --extensions=php --encoding=utf-8 --tab-width=4 -spv $(git diff --name-only --no-color --diff-filter=ACMRTUXB)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment