Skip to content

Commit

Permalink
try this
Browse files Browse the repository at this point in the history
  • Loading branch information
ssolson committed Feb 20, 2024
1 parent 77cf60c commit f5185e1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)"

0 comments on commit f5185e1

Please sign in to comment.