Joined January 2015
·

Tomáš Votruba

Brno, Czech Republic
·
·

Posted to Run Code Sniffer on modified files over 1 year ago

Negation was missing:

#!/bin/bash

FILES=$(git diff --name-only HEAD master);
if [ ! -z "$FILES" ]; then
    phpcs $FILES
fi
Posted to Run Code Sniffer on modified files over 1 year ago

One more improvement. If I want to have pre-commit hook, I need to include files in the commit. git ls-files -om --exclude-standard exclude those files.

This is the solution (so far):

#!/bin/bash

files=$(git diff --name-only HEAD master);
if [ -z $files ]; then
    phpcs $files
fi
Posted to Run Code Sniffer on modified files over 1 year ago

Awesome idea! Thanks for sharing :)

Achievements
1 Karma
0 Total ProTip Views