From 7c7e8242ed2e1bbcbff7568399545bef245c757e Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 5 Apr 2020 10:26:04 +0100 Subject: [PATCH] Static analysis script --- static_analysis | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 static_analysis diff --git a/static_analysis b/static_analysis new file mode 100755 index 00000000..4d454b41 --- /dev/null +++ b/static_analysis @@ -0,0 +1,25 @@ +#!/bin/bash + +if [ -f /usr/bin/flake8 ]; then + cmd="/usr/bin/flake8" +else + cmd="python3 -m flake8" +fi + +echo "Starting static analysis" + +for sourceFile in *.py +do + if [[ "$sourceFile" == 'tests.py' ]]; then + continue + fi + result=$($cmd "$sourceFile") + if [ "$result" ]; then + echo "$result" + exit 1 + fi +done + +echo "Static analysis complete" + +exit 0