diff options
Diffstat (limited to 'tools/infrastructure/check_style.sh')
-rwxr-xr-x | tools/infrastructure/check_style.sh | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/tools/infrastructure/check_style.sh b/tools/infrastructure/check_style.sh index f42a048b34..647427e793 100755 --- a/tools/infrastructure/check_style.sh +++ b/tools/infrastructure/check_style.sh @@ -27,15 +27,31 @@ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +FORMATER=clang-format-3.6 +INSTALL_CMD="sudo apt-get install -f $FORMATER" + +if [ "$1" = "--help" ] +then + echo "" + echo "Script checks c++ code style in all .h .cc and .cpp files" + echo "Uses $FORMATER as base tool. Install it with : $INSTALL_CMD" + echo "Usage: `basename $0` [option]" + echo " --fix Fix files format indirectly" + echo " --help Display this information" + exit 0 +fi + +command -v $FORMATER >/dev/null 2>&1 || { echo >&2 "$FORMATER is not installed. Use following: $INSTALL_CMD"; exit 1; } + FILE_NAMES=$(find src -name \*.h -print -o -name \*.cpp -print -o -name \*.cc -print | grep -v 3rd_party) check_style() { - clang-format-3.6 -style=file $1 | diff $1 - + $FORMATER -style=file $1 | diff $1 - } fix_style() { - clang-format-3.6 -style=file -i $1 + $FORMATER -style=file -i $1 } if [ "$1" = "--fix" ] |