From 72db7d33967a1e207f1a80038d55d6bb4d0765c7 Mon Sep 17 00:00:00 2001
From: Matthias Grob <maetugr@gmail.com>
Date: Tue, 8 May 2018 11:48:08 +0100
Subject: [PATCH] astyle: fix display language dependency

The shell script which checks the style relies on greping for the
keyword "Formatted" in the output of astyle. But the program has
localization support and will output in other languages e.g. german.
This leads to all style checks always succeeding. I only tested this
on Windows in Cygwin but I can imagine the problem also exists in
non-english Ubuntu installations.

Solution is the parameter --formatted of astyle which only produces
any output if there was something to fix. This allows for a display
language independent condition for an empty string inside the shell
script.
---
 Tools/astyle/check_code_style.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Tools/astyle/check_code_style.sh b/Tools/astyle/check_code_style.sh
index ddf89e601e..24ee4565dc 100755
--- a/Tools/astyle/check_code_style.sh
+++ b/Tools/astyle/check_code_style.sh
@@ -4,8 +4,8 @@ FILE=$1
 DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 
 if [ -f "$FILE" ]; then
-	${DIR}/fix_code_style.sh --dry-run $FILE | grep --quiet Formatted
-	if [[ $? -eq 0 ]]; then
+	CHECK_FAILED=$(${DIR}/fix_code_style.sh --dry-run --formatted $FILE)
+	if [[ $CHECK_FAILED ]]; then
 		${DIR}/fix_code_style.sh --quiet < $FILE > $FILE.pretty
 
 		echo
-- 
GitLab