Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NASA-AMMOS/slim#110: Functional Pylint static code analysis. ... #12

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -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