-
Notifications
You must be signed in to change notification settings - Fork 2
70 lines (60 loc) · 2.87 KB
/
CI_pylinter.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Inspired from: https://github.com/PyCQA/pylint/pull/2758#issuecomment-561164761
#
# Copyright (c) 2020-2023 MeteoSwiss, created by F.P.A. Vogt; [email protected]
name: CI_pylinter
on:
# Not required on push: no code should go to master directly
#push:
# branches: [ master ]
pull_request:
branches: [ master, develop, develop_vof ]
jobs:
pylinter:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.x']
steps:
# Checkout our repository
- name: Checkout current repository
uses: actions/checkout@v4
# Set up Python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# Install any dependency we require
- name: Install dependencies
run: |
python -m pip install --upgrade pip
shell: bash
# Here, let's install our module to make sure all the dependencies specified in setup.py are
# also installed
- name: Install our module
run: pip install -e .[dev]
shell: bash
# Launch a home-made python script with in-line arguments split over multiple lines.
# Here I use bash line breaks to feed each error codes on their own line. that way, I can
# comment on each of them. The comments are included by hijacking the bash backtick's command
# substitution.
# Inspired from https://stackoverflow.com/questions/9522631/how-to-put-a-line-comment-for-a-multi-line-command
# Authors: Marwan Alsabbagh, Kos
- name: Look for Exception-raising errors
run: |
python ./.github/workflows/pylinter.py --restrict E `# All errors are bad` \
C0303 `# trailing-whitespace` \
C0304 `# missing-final-newline` \
C0112 `# empty docstrings` \
C0114 `# missing-module-docstring` \
C0115 `# missing-class-docstring` \
C0116 `# missing-function-docstring` \
C0411 `# wrong-import-order` \
W0611 `# unused-import` \
W0612 `# unused-variable` \
shell: bash
# Do it again. But this time, just run the script for all possible pylint errors without
# issuing any exception.
- name: Look for all other pylint issue with a failure score threshold of 8
run: python ./.github/workflows/pylinter.py --min_score 8
shell: bash