From 4b26268b7458e49c12d824f4f52532839b74e2ae Mon Sep 17 00:00:00 2001 From: Aurelien Vaillant Date: Wed, 8 Jun 2022 18:25:11 +0200 Subject: [PATCH] Update the blender template with fix about the lint CI --- .github/lint.py | 25 +++++++++++++++++++++++ .github/workflows/linter.yml | 5 ++--- .run/Execute Pylinter CI.run.xml | 34 ++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 .github/lint.py create mode 100644 .run/Execute Pylinter CI.run.xml diff --git a/.github/lint.py b/.github/lint.py new file mode 100644 index 0000000..d4d0138 --- /dev/null +++ b/.github/lint.py @@ -0,0 +1,25 @@ +import sys +import os +import pathlib + +from pylint import lint + + +if __name__ == "__main__": + folder: str = '' + for v in sys.argv: + if '--module=' in v: + folder = v.replace('--module=', '') + + if folder is False: + print(f'Module folder not set.') + sys.exit(1) + + run = lint.Run([f'--rcfile={pathlib.Path(os.getcwd(), "linter", ".pylintrc")}', folder], + do_exit=False) + + if run.linter.stats.fatal or run.linter.stats.error: + print('Pylint failed.') + sys.exit(1) + + sys.exit(0) diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 702967d..9a37468 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -23,8 +23,7 @@ jobs: echo "::set-output name=folder::$(python '.github/package.py')" python -m pip install --upgrade pip python -m pip install -r linter/requirements_linter.txt - - - name: Execute the pylinter + - name: Execute Pylint run: | cd ${{ github.workspace }} - pylint --rcfile=${{ github.workspace }}/linter/.pylintrc ${{ steps.config.outputs.folder }} -E \ No newline at end of file + python '${{ github.workspace }}/.github/lint.py' --module=${{ steps.config.outputs.folder }} diff --git a/.run/Execute Pylinter CI.run.xml b/.run/Execute Pylinter CI.run.xml new file mode 100644 index 0000000..fc4f0ec --- /dev/null +++ b/.run/Execute Pylinter CI.run.xml @@ -0,0 +1,34 @@ + + + + + \ No newline at end of file