diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml new file mode 100644 index 0000000..b45b10d --- /dev/null +++ b/.github/workflows/pylint.yml @@ -0,0 +1,71 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to disable certain Pylint checks in the +# "Analyze" configuration block below. +# +# For more information see: +# https://nasa-ammos.github.io/slim/docs/guides/software-lifecycle/application-starter-kits/python-starter-kit/ +# +# ******** NOTE ******** +# Pylint is a Python-based linter that works to evaluate Python code. +# +name: "Pylint" + +on: + push: + branches: [main, develop] + pull_request: + # The branches below must be a subset of the branches above + branches: [develop] + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: write + contents: read + security-events: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + - name: Upgrade tooling + run: | + python3 -m pip install --upgrade pip + pip3 install --upgrade build importlib_metadata setuptools setuptools_scm wheel + pip3 install pylint + - name: Install dependencies + run: | + pip3 install -r requirements.txt + pip3 install -e . + - name: Prepare PYTHONPATH + run: | + src_paths=`find ${PWD} -type f -maxdepth 3 -mindepth 2 -name "*.py" -exec dirname {} + | uniq` + pythonpathplus="" + for p in $src_paths + do + pythonpathplus="${pythonpathplus:+:${pythonpathplus}}:$p" + done + echo "PYTHONPATH=${PYTHONPATH:+:${PYTHONPATH}}${pythonpathplus}:." >> $GITHUB_ENV + - name: Analyze + run: | + # disable docstring checks + # See https://pylint.readthedocs.io/en/latest/user_guide/messages/messages_overview.html + # pylint --disable=C0114,C0115,C0116 --recursive=y --output=pylint_report.txt --exit-zero . + pylint --recursive=y --output=pylint_report.txt --exit-zero . + continue-on-error: true + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: pylint_report + path: pylint_report.txt + if-no-files-found: error + overwrite: true + retention-days: 15 \ No newline at end of file