-
Notifications
You must be signed in to change notification settings - Fork 50
64 lines (56 loc) · 2.67 KB
/
Copy pathpython_lint.yml
File metadata and controls
64 lines (56 loc) · 2.67 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
name: Python Lint Check
on:
pull_request:
paths:
- '**.py' # only trigger on python files
jobs:
lint-changed-files:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Required to fetch the base branch for comparison
fetch-depth: 0
- name: Get changed Python files
id: changed-files-py
uses: tj-actions/changed-files@v46 # This action finds changed files
with:
files: |
**.py
- name: Set up Python
if: steps.changed-files-py.outputs.any_changed == 'true'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Pylint
if: steps.changed-files-py.outputs.any_changed == 'true'
run: python -m pip install pylint
- name: Install dependencies
if: steps.changed-files-py.outputs.any_changed == 'true'
run: python -m pip install -r requirements.txt
# Artifact name/description fields ship to the HTML report and the LAVA manifest
# and get quoted in casework, so they must not assert what the data means in the
# real world. See the script's docstring for the allowlist workflow.
- name: Guard against unsupported claim language
if: steps.changed-files-py.outputs.any_changed == 'true'
run: python admin/scripts/check_claim_language.py
# html_columns cells are written to the report without html.escape, so evidence
# placed there can inject markup, and any remote href/src makes opening a report
# beacon to a third party. Pre-existing findings are carried in the script's
# BASELINE and do not fail; new ones do. See the script's docstring.
- name: Guard report output against injection and remote destinations
if: steps.changed-files-py.outputs.any_changed == 'true'
run: python admin/scripts/check_html_safety.py
# Fails only on warnings this pull request introduces. rleapp.py and
# rleappGUI.py carry pre-existing warnings that are structural rather than
# fixable -- wildcard imports are how those modules are put together -- so
# failing on the absolute count would make every pull request that touches
# them red for reasons unrelated to the change. See the script's docstring.
- name: Run on changed files
if: steps.changed-files-py.outputs.any_changed == 'true'
run: |
BASE=$(git merge-base "origin/${{ github.base_ref }}" HEAD)
echo "Comparing against merge base $BASE"
python admin/scripts/lint_changed.py --base-ref "$BASE" \
${{ steps.changed-files-py.outputs.all_changed_files }}