-
Notifications
You must be signed in to change notification settings - Fork 5
95 lines (88 loc) · 3.12 KB
/
python-stylecheck.yml
File metadata and controls
95 lines (88 loc) · 3.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# This workflow will install Python dependencies and style check with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python Style Checks
# No need for more than read permission
permissions:
contents: read
on:
# Triggers the workflow on push or pull request events but only for this git branch
push:
paths-ignore:
- 'README'
- 'COPYING'
- 'NEWS'
- '*.txt'
- 'doc/**'
- 'doc-src/**'
- 'user-projects/**'
- 'state/**'
- 'certs/**'
- 'MiG-certificates/**'
- 'mig/images/**'
- 'mig/assets/**'
- 'mig/src/**'
- 'mig/apache/**'
- 'mig/bin/**'
branches:
- experimental
- next
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
paths-ignore:
- 'README'
- 'COPYING'
- 'NEWS'
- '*.txt'
- 'doc/**'
- 'doc-src/**'
- 'user-projects/**'
- 'state/**'
- 'certs/**'
- 'MiG-certificates/**'
- 'mig/images/**'
- 'mig/assets/**'
- 'mig/src/**'
- 'mig/apache/**'
- 'mig/bin/**'
branches:
- experimental
- next
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
stylecheckpython:
name: Style check python and annotate
runs-on: ubuntu-latest
steps:
- name: Check out source repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # This is necessary to get the commits
- name: Get changed python files between base and head
run: >
echo "CHANGED_FILES=$(echo $(git diff --diff-filter=ACMRTB --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} -- | grep -E '\.py$'))" >> $GITHUB_ENV
- if: ${{ env.CHANGED_FILES }}
uses: marian-code/python-lint-annotate@v4
with:
python-root-list: ${{ env.CHANGED_FILES }}
extra-pycodestyle-options: "--max-line-length=80"
extra-black-options: "--line-length=80"
extra-isort-options: "--line-length=80 -m=HANGING_INDENT"
# NOTE: we disable flake8 and pylint here to avoid overlap with lint action and limit noise
use-flake8: false
extra-flake8-options: "--max-line-length=80"
use-pylint: false
# NOTE: pylint C0209 string format suggestions requires python3.6+ so disable here
# https://pylint.pycqa.org/en/latest/user_guide/messages/convention/consider-using-f-string.html
extra-pylint-options: "--max-line-length=80 --disable=C0209"
# NOTE: we require docstrings on all public classes and functions
# for now we do not enforce all additional format and content rules.
use-pydocstyle: true
extra-pydocstyle-options: "--ignore=D2,D4"
use-mypy: true
# NOTE: don't err on common missing type definitions
extra-mypy-options: "--disable-error-code=var-annotated --disable-error-code=assignment --disable-error-code=attr-defined"