Skip to content

Lint Updates

Lint Updates #16459

Workflow file for this run

name: Static Code Analysis
on: [push]
jobs:
prospector:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.13
- name: Install dependencies
run: |
pip install prospector[with_bandit]==1.17.1
- name: Prospector
run: |
# Find changed Python files
CHANGED_FILES=$(git diff --no-commit-id --name-only --no-renames HEAD..origin/master | grep '\.py$' | xargs -I {} sh -c 'if [ -f "{}" ]; then echo "{}"; fi')
echo -e "
========================================
ALL CHANGED FILES
========================================
\n$CHANGED_FILES"
# Filter out excluded files
FILTER="(schema\.py|setup\.py|__init__\.py|ec2_investigations|unit_test\/)"
FILTERED_FILES=$(echo "$CHANGED_FILES" | grep -v -E "$FILTER" || echo "")
# Run prospector if there are files to check
if [ -n "$FILTERED_FILES" ]; then
echo -e "
========================================
FILES AFTER FILTERING
========================================
\n$FILTERED_FILES"
echo -e "
========================================
RUNNING PROSPECTOR
========================================
"
prospector $FILTERED_FILES --profile prospector.yaml --tool bandit --tool mccabe --tool pylint --tool pyflakes
else
echo "No Python files changed, so prospector was not run."
fi