-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (53 loc) · 1.95 KB
/
pylint.yml
File metadata and controls
59 lines (53 loc) · 1.95 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
name: Pylint
on:
workflow_dispatch:
push:
paths:
- '**.py'
pull_request:
paths:
- '**.py'
permissions:
contents: read
jobs:
analyze:
runs-on: ubuntu-latest
env:
PYTHON_VERSION: '3.13'
steps:
- name: Harden Runner
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
with:
egress-policy: audit
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v5
- name: Set up Python
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install global dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pylint
- name: Lint all functions
run: |
# Find all subdirectories in functions/ that contain Python files
for func_dir in functions/*/; do
if [ -d "$func_dir" ] && find "$func_dir" -name "*.py" -type f | grep -q .; then
func_name=$(basename "$func_dir")
echo "::group::Processing $func_name"
# Install function-specific dependencies if requirements.txt exists
if [ -f "$func_dir/requirements.txt" ]; then
echo "Installing dependencies for $func_name..."
pip install -r "$func_dir/requirements.txt"
else
echo "No requirements.txt found for $func_name, skipping dependency installation"
fi
# Run pylint on the function directory
echo "Running pylint on $func_name..."
pylint "$func_dir" --max-line-length=127 --disable=R0801 --py-version=${{ env.PYTHON_VERSION }} || {
echo "::error::Pylint failed for $func_name"
exit 1
}
echo "::endgroup::"
fi
done