-
Notifications
You must be signed in to change notification settings - Fork 188
40 lines (35 loc) · 1.24 KB
/
python-linting.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
# This workflow will lint python code with flake8.
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python linting
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '30 5 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-linting.txt
- name: Check sorted python imports using isort
run: |
isort . -c
- name: Lint code with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# The GitHub editor is 127 chars wide.
flake8 . --count --max-complexity=30 --max-line-length=127 --statistics
# Check for cyclometric complexity for specific files where this metric has been
# reduced to ten and below
flake8 dice_ml/data_interfaces/ --count --max-complexity=10 --max-line-length=127