From f5185e1615528859f86e4184312f73bce6651209 Mon Sep 17 00:00:00 2001 From: ssolson Date: Tue, 20 Feb 2024 10:53:15 -0700 Subject: [PATCH] try this --- .github/workflows/pylint.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 54f528bf2..bf35abd66 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -22,9 +22,15 @@ jobs: - name: Run Pylint on mhkit/loads/ and check score run: | - pylint_output=$(pylint mhkit/loads/ --output-format=text) + # Run pylint and capture the output + pylint_output=$(pylint mhkit/loads/ --output-format=text || true) echo "$pylint_output" - score=$(echo "$pylint_output" | grep "Your code has been rated at" | awk '{print $7}' | sed 's/\/10//') + # Extract the score from the output, handling cases where score is not found + score=$(echo "$pylint_output" | grep "Your code has been rated at" | awk '{print $7}' | sed 's/\/10//' || echo "0") echo "Pylint score: $score" + # Define the minimum acceptable score min_score=8.0 - python -c "import sys; sys.exit(0 if $score >= $min_score else 1)" + # Check if score is a number, exit with code 1 (failure) if not + python -c "import sys; score='$score'; sys.exit(0 if score.replace('.', '', 1).isdigit() else 1)" + # Compare the score with the minimum acceptable score, exit with code 1 if below threshold + python -c "import sys; sys.exit(0 if float('$score') >= $min_score else 1)"