ansible: Use HTTP/1.1 for git http operations on Debian bookworm
[lttng-ci.git] / scripts / babeltrace / pylint.sh
index ffb45b9ec98a699fb4f03c00d79fd031f8e11e0f..63e02a8db9cedb7af41f6897fe8e3939aefccdd9 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/bash -exu
+#!/bin/bash
 #
 # Copyright (C) 2019 Michael Jeanson <mjeanson@efficios.com>
 # Copyright (C) 2019 Francis Deslauriers <francis.deslauriers@efficios.com>
@@ -16,6 +16,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+set -exu
+
 set -o pipefail
 
 PYTHON3=python3
@@ -32,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
@@ -50,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.023546 seconds and 4 git commands to generate.