summaryrefslogtreecommitdiff
path: root/tools/infrastructure
diff options
context:
space:
mode:
authorAlexander Kutsan <AKutsan@luxoft.com>2016-07-07 17:53:22 +0300
committerAlexander Kutsan <AKutsan@luxoft.com>2016-07-07 17:53:22 +0300
commit42105e79603e7bb84c7e0c36a33be212c9a608f7 (patch)
treeaaf78548cefb96688a2ec8ec1d342d36b80916cb /tools/infrastructure
parent0ed1efdaaab152423578315f85758bc853cb8f84 (diff)
downloadsdl_core-42105e79603e7bb84c7e0c36a33be212c9a608f7.tar.gz
Improove check_style.sh script to support fix style
Diffstat (limited to 'tools/infrastructure')
-rwxr-xr-xtools/infrastructure/check_style.sh21
1 files changed, 17 insertions, 4 deletions
diff --git a/tools/infrastructure/check_style.sh b/tools/infrastructure/check_style.sh
index 0b58af3c95..f42a048b34 100755
--- a/tools/infrastructure/check_style.sh
+++ b/tools/infrastructure/check_style.sh
@@ -28,7 +28,20 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
FILE_NAMES=$(find src -name \*.h -print -o -name \*.cpp -print -o -name \*.cc -print | grep -v 3rd_party)
-for FILE_NAME in $FILE_NAMES
-do
- clang-format-3.6 -style=file $FILE_NAME | diff $FILE_NAME -
-done
+
+
+check_style() {
+ clang-format-3.6 -style=file $1 | diff $1 -
+}
+
+fix_style() {
+ clang-format-3.6 -style=file -i $1
+}
+
+if [ "$1" = "--fix" ]
+then
+ for FILE_NAME in $FILE_NAMES; do fix_style $FILE_NAME; done
+else
+ for FILE_NAME in $FILE_NAMES; do check_style $FILE_NAME; done
+fi
+