@@ -291,6 +291,7 @@ jobs:
291291
292292 fi;
293293
294+
294295 echo "Exit code was $EXITCODE";
295296
296297 if [ "${EXITCODE}" ]; then
@@ -306,29 +307,135 @@ jobs:
306307 echo "Exit code was ${EXITCODE}";
307308
308309
309- - name : Fail on Error
310- if : steps.lint.outputs.exit_code == 1
310+
311+ - name : Lint ${{ matrix.python-version }} Bitwise check exit code
312+ id : lint-exit-type
313+ if : inputs.LINT && needs.init.outputs.py-any-changed
311314 shell : bash
315+ env :
316+ EXITCODE : ${{ steps.lint.outputs.exit_code }}
312317 run : |
313- echo "Lint exit code was ${{ steps.lint.outputs.exit_code }}"
318+ # Check error code for exit type
319+ # https://pylint.pycqa.org/en/latest/user_guide/usage/run.html#exit-codes
320+
321+ echo "PyLint uses an exit code that is bit-encoded which is bitwise checked for the severities found. ";
322+
323+ if (( $EXITCODE & 1 )); then
324+
325+ echo "Bitwise found: fatal";
326+
327+ echo "fatal=true" >> $GITHUB_OUTPUT
328+
329+ else
330+
331+ echo "fatal=false" >> $GITHUB_OUTPUT
332+
333+ fi
334+
335+
336+ if (( $EXITCODE & 2 )); then
337+
338+ echo "Bitwise found: error";
339+
340+ echo "error=true" >> $GITHUB_OUTPUT
341+
342+ else
343+
344+ echo "error=false" >> $GITHUB_OUTPUT
345+
346+ fi
347+
348+
349+ if (( $EXITCODE & 4 )); then
350+
351+ echo "Bitwise found: warning";
352+
353+ echo "warning=true" >> $GITHUB_OUTPUT
354+
355+ else
356+
357+ echo "warning=false" >> $GITHUB_OUTPUT
358+
359+ fi
360+
361+
362+ if (( $EXITCODE & 8 )); then
363+
364+ echo "Bitwise found: refactor";
365+
366+ echo "refactor=true" >> $GITHUB_OUTPUT
367+
368+ else
369+
370+ echo "refactor=false" >> $GITHUB_OUTPUT
371+
372+ fi
373+
374+
375+ if (( $EXITCODE & 16 )); then
376+
377+ echo "Bitwise found: convention";
378+
379+ echo "convention=true" >> $GITHUB_OUTPUT
380+
381+ else
382+
383+ echo "convention=false" >> $GITHUB_OUTPUT
384+
385+ fi
386+
387+
388+ if (( $EXITCODE & 32 )); then
389+
390+ echo "Bitwise found: usage error";
391+
392+ echo "usage_error=true" >> $GITHUB_OUTPUT
393+
394+ else
395+
396+ echo "usage_error=false" >> $GITHUB_OUTPUT
397+
398+ fi
399+
314400
315401
316402 - name : Fail on Fatal
317- if : steps.lint.outputs.exit_code == 2
403+ if : steps.lint-exit-type.outputs.fatal == 'true'
404+ shell : bash
405+ run : |
406+ echo "Lint exit code was ${{ steps.lint.outputs.exit_code }}"
407+
408+
409+ - name : Fail on Error
410+ if : steps.lint-exit-type.outputs.error == 'true'
318411 shell : bash
319412 run : |
320413 echo "Lint exit code was ${{ steps.lint.outputs.exit_code }}"
321414
322415
323416 - name : Fail on Warning
324- if : inputs.LINT_ERROR_ON_WARNING && steps.lint.outputs.exit_code == 4
417+ if : steps.lint-exit-type.outputs.warning == 'true'
418+ shell : bash
419+ run : |
420+ echo "Lint exit code was ${{ steps.lint.outputs.exit_code }}"
421+
422+
423+ - name : Fail on Refactor
424+ if : steps.lint-exit-type.outputs.refactor == 'true'
425+ shell : bash
426+ run : |
427+ echo "Lint exit code was ${{ steps.lint.outputs.exit_code }}"
428+
429+
430+ - name : Fail on Convention
431+ if : steps.lint-exit-type.outputs.convention == 'true'
325432 shell : bash
326433 run : |
327434 echo "Lint exit code was ${{ steps.lint.outputs.exit_code }}"
328435
329436
330437 - name : Fail on Usage Error
331- if : steps.lint.outputs.exit_code == 32
438+ if : steps.lint-exit-type .outputs.usage_error == 'true'
332439 shell : bash
333440 run : |
334441 echo "Lint exit code was ${{ steps.lint.outputs.exit_code }}"
0 commit comments