From 10d17b4a354bd7e5a4ae9f29b8daa9aff92b97d3 Mon Sep 17 00:00:00 2001
From: Matej Ferencevic <matej.ferencevic@memgraph.io>
Date: Fri, 12 Jan 2018 10:19:37 +0100
Subject: [PATCH] Fix Apollo clang-format warnings

Reviewers: florijan

Reviewed By: florijan

Differential Revision: https://phabricator.memgraph.io/D1103
---
 tools/apollo/apollo_runs.yaml |  1 +
 tools/apollo/cppcheck         | 10 ++++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/apollo/apollo_runs.yaml b/tools/apollo/apollo_runs.yaml
index c1bf1a497..608a7da74 100644
--- a/tools/apollo/apollo_runs.yaml
+++ b/tools/apollo/apollo_runs.yaml
@@ -6,5 +6,6 @@
     - ../../tests # tests source dir
     - ../../poc # poc source dir
     - ../../.git # git directory (used to find out changed files in commit)
+    - ../../.clang-format # clang-format config file
   outfile_paths:
     - \./memgraph/tools/apollo/\.cppcheck_errors
diff --git a/tools/apollo/cppcheck b/tools/apollo/cppcheck
index 3fe374c79..72083d788 100755
--- a/tools/apollo/cppcheck
+++ b/tools/apollo/cppcheck
@@ -55,17 +55,19 @@ fi
 format_list=""
 format_tmp="$DIR/.clang_format"
 
+if [ -f "$format_tmp" ]; then
+    rm "$format_tmp"
+fi
+
 for fname in $files; do
     if [ ! -f "$fname" ]; then continue; fi
+    echo "Checking formatting errors for: $fname"
     clang-format "$fname" > "$format_tmp"
     if ! diff "$fname" "$format_tmp" >/dev/null; then
         format_list+="\n$fname"
     fi
-done
-
-if [ -f "$format_tmp" ]; then
     rm "$format_tmp"
-fi
+done
 
 if [ "$format_list" != "" ]; then
     if [ "$( cat "$errfile" | wc -l )" -gt 0 ]; then