forked from openmv/openmv
-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (39 loc) · 1.41 KB
/
python-linter.yml
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: '🔎 Python Linter'
on:
pull_request:
types:
- opened
- reopened
- synchronize
branches:
- 'master'
paths:
- 'scripts/examples/**.py'
- 'scripts/libraries/**.py'
jobs:
formatting-check:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
python-version: ["3.10"]
steps:
- name: '⏳ Checkout repository'
uses: actions/checkout@v4
- name: '🐍 Set up Python ${{ matrix.python-version }}'
uses: actions/setup-python@v5
with:
cache: 'pip'
python-version: ${{ matrix.python-version }}
- name: '🛠 Install dependencies'
run: |
pip install -r .github/workflows/requirements.txt
flake8 --version
pytest --version
- name: '😾 Lint with flake8'
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 --count --select=E9,F63,F7,F82 --ignore=F821 --show-source --statistics scripts/libraries/ scripts/examples/
flake8 --count --max-complexity=15 --max-line-length=120 --ignore=F821,E722,E741,C901,E713,W605,E203,W503,F841,F403,F405 --statistics scripts/libraries/ scripts/examples/