Skip to content

Commit fb5958c

Browse files
committed
feat: When linting, only show GH annotations for primary python version
ref: nofusscomputing/centurion_erp#1201
1 parent fc65a58 commit fb5958c

1 file changed

Lines changed: 53 additions & 2 deletions

File tree

‎.github/workflows/python.yaml‎

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
outputs:
5353
changed-files: ${{ steps.changed-files.outputs.project_all_changed_files }}
5454
doc-changed-files: ${{ steps.changed-files.outputs.docs_changed_files }}
55-
py-changed-files: ${{ steps.changed-files.outputs.all_changed_and_modified_files }}
55+
py-changed-files: ${{ steps.changed-files.outputs.all_changed_files }}
5656
pip-any-changed: ${{ steps.changed-files-pip.outputs.any_changed}}
5757
py-any-changed: ${{ steps.changed-files.outputs.any_changed}}
5858
tesy-changed-files: ${{ steps.changed-files.outputs.test_changed_files }}
@@ -231,14 +231,65 @@ jobs:
231231
pip install -r requirements_dev.txt
232232
233233
234+
235+
#
236+
# PyLint C value
237+
#
238+
# [I]nformational messages that Pylint emits (do not contribute to your analysis score)
239+
240+
# [R]efactor for a "good practice" metric violation
241+
242+
# [C]onvention for coding standard violation
243+
244+
# [W]arning for stylistic problems, or minor programming issues
245+
246+
# [E]rror for important programming issues (i.e. most probably bug)
247+
248+
# [F]atal for errors which prevented further processing
234249
- name: Lint ${{ matrix.python-version }}
235250
id: lint
236251
if: inputs.LINT && needs.init.outputs.py-any-changed
237252
shell: bash
238253
env:
239254
PY_CHANGED_FILES: ${{ needs.init.outputs.py-changed-files }}
240255
run: |
241-
pylint --py-version ${{ matrix.python-version }} --msg-template "::notice file={path},line={line},endLine={end_line},title={msg_id}::{msg} see https://pylint.pycqa.org/en/latest/user_guide/messages/{category}/{symbol}.html" ${PY_CHANGED_FILES} || EXITCODE=$?
256+
set +e;
257+
258+
echo "Primary Python version [${{ inputs.PYTHON_VERSION }}], Matrix Python Version [${{ matrix.python-version }}]";
259+
260+
if [ "${{ inputs.PYTHON_VERSION }}" != "${{ matrix.python-version }}" ]; then
261+
262+
echo "Only show Github annotations for primary Python version: ${{ inputs.PYTHON_VERSION }}";
263+
264+
pylint \
265+
--py-version ${{ matrix.python-version }} \
266+
${PY_CHANGED_FILES} || EXITCODE=$?
267+
268+
else
269+
270+
# available are debug, notice, warning, error
271+
272+
export I=debug;
273+
export R=notice;
274+
export C=warning;
275+
export W=warning;
276+
export E=error;
277+
export F=error;
278+
279+
pylint --py-version ${{ matrix.python-version }} --msg-template "::${C} file={path},line={line},endLine={end_line},title={msg_id}::{msg} see <https://pylint.pycqa.org/en/latest/user_guide/messages/{category}/{symbol}.html>" ${PY_CHANGED_FILES} | envsubst;
280+
281+
export EXITCODE=${PIPESTATUS[0]}
282+
283+
# pylint \
284+
# --py-version ${{ matrix.python-version }} \
285+
# --msg-template "::notice \
286+
# file={path}, \
287+
# line={line}, \
288+
# endLine={end_line}, \
289+
# title={msg_id}::{msg} see https://pylint.pycqa.org/en/latest/user_guide/messages/{category}/{symbol}.html" \
290+
# ${PY_CHANGED_FILES} || EXITCODE=$?
291+
292+
fi;
242293
243294
echo "Exit code was $EXITCODE";
244295

0 commit comments

Comments
 (0)