-
Notifications
You must be signed in to change notification settings - Fork 171
67 lines (56 loc) · 2.12 KB
/
Copy pathpylint.yml
File metadata and controls
67 lines (56 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Pylint
on:
pull_request:
branches:
- main
- staging
- release_1.7.1
- pub/build_stream
- pub/q2_dev
- pub/telemetry
- pub/q2_upgrade
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
env:
PYLINT_THRESHOLD: 8
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ansible pylint kubernetes prettytable requests passlib fastapi uvicorn sqlalchemy pytest httpx argon2-cffi pyyaml dependency-injector
- name: Get changed Python files (excluding deleted)
id: changed-files
run: |
git fetch origin ${{ github.base_ref }}
CHANGED=$(git diff --name-only --diff-filter=d origin/${{ github.base_ref }} HEAD -- '*.py' || true)
FILES=""
for f in $CHANGED; do
if [ -f "$f" ]; then
FILES="$FILES $f"
fi
done
FILES=$(echo "$FILES" | xargs) # Trim extra spaces
echo "Filtered files: $FILES"
echo "files=$FILES" >> "$GITHUB_OUTPUT"
- name: Run pylint on changed files
if: steps.changed-files.outputs.files != ''
run: |
echo "Running pylint on: ${{ steps.changed-files.outputs.files }}"
# Filter out files from the excluded directory
FILES=$(echo "${{ steps.changed-files.outputs.files }}" | tr ' ' '\n' | grep -v '^discovery/roles/telemetry/files/nersc-ldms-aggr/' | xargs)
if [ -n "$FILES" ]; then
# Set PYTHONPATH to include build_stream directory for proper import resolution
# This allows pylint to resolve both relative imports in build_stream and regular imports elsewhere
PYTHONPATH=.:./build_stream pylint $FILES --fail-under=${PYLINT_THRESHOLD}
else
echo "No files to lint after filtering."
fi