jjb: babeltrace: Add 'isort' to pylint jobs
authorMichael Jeanson <mjeanson@efficios.com>
Thu, 19 Oct 2023 19:14:40 +0000 (15:14 -0400)
committerMichael Jeanson <mjeanson@efficios.com>
Thu, 19 Oct 2023 19:14:46 +0000 (15:14 -0400)
Requested by Simon, the script makes sure it doesn't run on stable-15
and stable-2.0 where it's not supported.

Change-Id: Ia4617feff900fe7ca9542c06974f1b45371d011b
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
jobs/babeltrace.yaml
scripts/babeltrace/pylint.sh

index 8a4ed6a8af28710a1dc98f8d7dfff01c4ea9da3f..51dd99e5762e10984508a472d8605076ec8a417e 100644 (file)
     publishers:
       - workspace-cleanup: *babeltrace_publisher_workspace-cleanup_defaults
       - archive:
-          artifacts: 'black.out,flake8.out'
+          artifacts: 'black.out,flake8.out,isort.out'
           allow-empty: false
       - ircbot: *babeltrace_publisher_ircbot_defaults
       - email-ext: *babeltrace_publisher_email-ext_defaults
index 839d86266da2edfe4c686ac06e0967b9e4d02270..63e02a8db9cedb7af41f6897fe8e3939aefccdd9 100755 (executable)
@@ -34,15 +34,14 @@ fi
 virtualenv --system-site-packages -p ${PYTHON3} "$PYENV_HOME"
 
 set +ux
-# shellcheck disable=SC1090
+# shellcheck disable=SC1090,SC1091
 . "$PYENV_HOME/bin/activate"
 set -ux
 
 if [ -f "$SRCDIR/dev-requirements.txt" ]; then
     pip install -r "$SRCDIR/dev-requirements.txt"
 else
-    pip install --quiet black
-    pip install --quiet flake8
+    pip install black flake8 isort
 fi
 
 exit_code=0
@@ -52,4 +51,13 @@ cd "$SRCDIR"
 black --diff --check . | tee ../../black.out || exit_code=1
 flake8 --output-file=../../flake8.out --tee || exit_code=1
 
+ISORT_UNSUPPORTED_BRANCH_REGEX='.*(stable-1\.5|stable-2\.0)$'
+
+if [[ ! ${GIT_BRANCH:-} =~ $ISORT_UNSUPPORTED_BRANCH_REGEX ]] && \
+    [[ ! ${GERRIT_BRANCH:-} =~ $ISORT_UNSUPPORTED_BRANCH_REGEX ]]; then
+    isort . --diff --check | tee ../../isort.out || exit_code=1
+else
+    echo "isort is not supported on the 'stable-2.0' branch" > ../../isort.out
+fi
+
 exit $exit_code
This page took 0.024499 seconds and 4 git commands to generate.