#!/bin/bash TOTAL_ERRORS=0 # The trick to remove deleted files: https://stackoverflow.com/a/2413151 for file in $(git diff --cached --name-status | awk '$1 != "D" {print $2}' | \ grep -v ".pb.cpp" | grep -v ".pb.h" | grep -v ".pb-c.h" | grep -v ".pb-c.c" | \ grep -v "protobuf-c.h" | grep -v "protobuf-c.c" | grep -v "src/io/jni/paddle_mobile_jni.cpp"); do cpplint $file; TOTAL_ERRORS=$(expr $TOTAL_ERRORS + $?); done exit $TOTAL_ERRORS