Browse Source

HUE-9446 [ci] Improve Python lint checking detection script

Romain 5 năm trước cách đây
mục cha
commit
cdea845d9a

+ 1 - 1
desktop/core/src/desktop/management/commands/runpylint.py

@@ -60,7 +60,7 @@ class Command(BaseCommand):
 
     # Note that get_build_dir() is suitable for testing use only.
     pylint_prog = paths.get_build_dir('env', 'bin', 'pylint')
-    pylint_args = [pylint_prog, "--rcfile=" + settings.PYLINTRC]
+    pylint_args = [pylint_prog, "--rcfile=" + settings.PYLINTRC, "--load-plugins", "pylint_django"]
 
     if options['files']:
       pylint_args.extend(options['files'].split(' '))

+ 10 - 5
tools/ci/check_for_python_lint.sh

@@ -17,16 +17,21 @@
 
 # Checking all python changes in the new commits
 
-FOUND_ISSUE=0
+FOUND_ISSUE=-1
 
 files=`git diff --name-only origin/master --diff-filter=b | egrep .py$ | grep -v /ext-py/`
 
-./build/env/bin/hue runpylint --files="$files"
+if [ ! -z "$files" ];
+then
+  ./build/env/bin/hue runpylint --files "$files"
+fi
 
-if [ "$?" -eq "0" ]
+if [ -z "$files" ] || [ "$?" -eq "0" ]
 then
-  echo "Found some Python Code styling issues"
-  FOUND_ISSUE=-1
+  FOUND_ISSUE=0
+  echo "No Python code styling issues found"
+else
+  echo "Found some Python code styling issues"
 fi
 
 exit $FOUND_ISSUE