Skip to content

Commit e3b43b1

Browse files
Add problem matchers; Also run Vulture
1 parent 54103df commit e3b43b1

File tree

8 files changed

+141
-23
lines changed

8 files changed

+141
-23
lines changed

.github/flake8.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"severity": "warning",
5+
"pattern": [
6+
{
7+
"regexp": "^(\\033\\[0m)?([^:]+):(\\d+):(\\d+): ([A-Z]\\d{3}) (.*)$",
8+
"file": 2,
9+
"line": 3,
10+
"column": 4,
11+
"code": 5,
12+
"message": 6
13+
}
14+
],
15+
"owner": "flake8"
16+
}
17+
]
18+
}

.github/mypy.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"pattern": [
5+
{
6+
"regexp": "^(\\033\\[0m)?([^:]+):(\\d+): ([^:]+): (.*) \\[(.*)\\]$",
7+
"file": 2,
8+
"line": 3,
9+
"severity": 4,
10+
"message": 5,
11+
"code": 6
12+
}
13+
],
14+
"owner": "mypy"
15+
}
16+
]
17+
}

.github/pylint-error.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"severity": "error",
5+
"pattern": [
6+
{
7+
"regexp": "^([^:]+):(\\d+):(\\d+): (E\\d+): \\033\\[[\\d;]+m([^\\033]+).*$",
8+
"file": 1,
9+
"line": 2,
10+
"column": 3,
11+
"code": 4,
12+
"message": 5
13+
}
14+
],
15+
"owner": "pylint-error"
16+
}
17+
]
18+
}

.github/pylint-warning.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"severity": "warning",
5+
"pattern": [
6+
{
7+
"regexp": "^([^:]+):(\\d+):(\\d+): ([A-DF-Z]\\d+): \\033\\[[\\d;]+m([^\\033]+).*$",
8+
"file": 1,
9+
"line": 2,
10+
"column": 3,
11+
"code": 4,
12+
"message": 5
13+
}
14+
],
15+
"owner": "pylint-warning"
16+
}
17+
]
18+
}

.github/vulture.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"severity": "warning",
5+
"pattern": [
6+
{
7+
"regexp": "^([^:]+):(\\d+): ([^(]+ \\(\\d+% confidence\\))$",
8+
"file": 1,
9+
"line": 2,
10+
"message": 3
11+
}
12+
],
13+
"owner": "vulture"
14+
}
15+
]
16+
}

.github/workflows/all-lints.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,4 @@ jobs:
88

99
steps:
1010
- uses: actions/checkout@v1
11-
- uses: ricardochaves/python-lint@master
12-
with:
13-
python-root-list: "tests"
11+
- uses: rahul-deepsource/plint@master

action.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ inputs:
44
python-root-list:
55
description: "A list of all paths to test"
66
required: false
7-
default: "."
7+
default: "./**/*.py"
88
use-pylint:
99
description: "Use Pylint"
1010
required: false
@@ -29,6 +29,10 @@ inputs:
2929
description: "Use isort"
3030
required: false
3131
default: true
32+
use-vulture:
33+
description: "Use vulture"
34+
required: false
35+
default: true
3236
extra-pylint-options:
3337
description: "Extra options: pylint $(extra-pylint-options) $(python-root-list)"
3438
required: false
@@ -53,6 +57,10 @@ inputs:
5357
description: "Extra options: isort -rc $(extra-isort-options) $(python-root-list) -c --diff "
5458
required: false
5559
default: ""
60+
extra-vulture-options:
61+
description: "Extra options: vulture $(extra-vulture-options) $(python-root-list)"
62+
required: false
63+
default: ""
5664

5765
runs:
5866
using: "docker"
@@ -65,12 +73,14 @@ runs:
6573
- ${{ inputs.use-black }}
6674
- ${{ inputs.use-mypy }}
6775
- ${{ inputs.use-isort }}
76+
- ${{ inputs.use-vulture }}
6877
- ${{ inputs.extra-pylint-options }}
6978
- ${{ inputs.extra-pycodestyle-options }}
7079
- ${{ inputs.extra-flake8-options }}
7180
- ${{ inputs.extra-black-options }}
7281
- ${{ inputs.extra-mypy-options }}
7382
- ${{ inputs.extra-isort-options }}
83+
- ${{ inputs.extra-vulture-options }}
7484
branding:
7585
icon: "terminal"
7686
color: "white"

entrypoint.sh

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,28 @@
99
# $5 - use-black
1010
# $6 - use-mypy
1111
# $7 - use-isort
12-
# $8 - extra-pylint-options
13-
# $9 - extra-pycodestyle-options
14-
# ${10} - extra-flake8-options
15-
# ${11} - extra-black-options
16-
# ${12} - extra-mypy-options
17-
# ${13} - extra-isort-options
12+
# $8 - use-vulture
13+
# $9 - extra-pylint-options
14+
# ${10} - extra-pycodestyle-options
15+
# ${11} - extra-flake8-options
16+
# ${12} - extra-black-options
17+
# ${13} - extra-mypy-options
18+
# ${14} - extra-isort-options
19+
# ${15} - extra-vulture-options
1820

1921
if [ "$2" = true ] ; then
2022

21-
echo Running: pylint $8 $1
23+
echo Running: pylint $9 $1
2224

23-
pylint $8 $1
25+
pylint $9 $1
2426
exit_code=$?
2527

2628
if [ "$exit_code" = "0" ]; then
2729
echo "Pylint ok"
2830
else
2931
echo "Pylint error"
32+
echo "::add-matcher::$(pwd)/.github/pylint-error.json"
33+
echo "::add-matcher::$(pwd)/.github/pylint-warning.json"
3034
exit $exit_code
3135
fi
3236

@@ -35,9 +39,9 @@ fi
3539

3640
if [ "$3" = true ] ; then
3741

38-
echo Running: pycodestyle $9 $1
42+
echo Running: pycodestyle ${10} $1
3943

40-
pycodestyle $9 $1
44+
pycodestyle ${10} $1
4145
exit_code=$?
4246

4347
if [ "$exit_code" = "0" ]; then
@@ -51,25 +55,26 @@ fi
5155

5256
if [ "$4" = true ] ; then
5357

54-
echo Running: flake8 ${10} $1
58+
echo Running: flake8 ${11} $1
5559

56-
flake8 ${10} $1
60+
flake8 ${11} $1
5761
exit_code=$?
5862

5963
if [ "$exit_code" = "0" ]; then
6064
echo "Flake8 ok"
6165
else
6266
echo "Flake8 error"
67+
echo "::add-matcher::$(pwd)/.github/flake8.json"
6368
exit $exit_code
6469
fi
6570

6671
fi
6772

6873
if [ "$5" = true ] ; then
6974

70-
echo Running: black --check ${11} $1
75+
echo Running: black --check ${12} $1
7176

72-
black --check ${11} $1
77+
black --check ${12} $1
7378
exit_code=$?
7479

7580
if [ "$exit_code" = "0" ]; then
@@ -83,25 +88,26 @@ fi
8388

8489
if [ "$6" = true ] ; then
8590

86-
echo Running: mypy ${12} $1
91+
echo Running: mypy ${13} $1
8792

88-
mypy ${12} $1
93+
mypy ${13} $1
8994
exit_code=$?
9095

9196
if [ "$exit_code" = "0" ]; then
9297
echo "mypy ok"
9398
else
9499
echo "mypy error"
100+
echo "::add-matcher::$(pwd)/.github/mypy.json"
95101
exit $exit_code
96102
fi
97103

98104
fi
99105

100106
if [ "$7" = true ] ; then
101107

102-
echo Running: isort ${13} $1 -c --diff
108+
echo Running: isort ${14} $1 -c --diff
103109

104-
isort ${13} $1 -c --diff
110+
isort ${14} $1 -c --diff
105111
exit_code=$?
106112

107113
if [ "$exit_code" = "0" ]; then
@@ -111,4 +117,21 @@ if [ "$7" = true ] ; then
111117
exit $exit_code
112118
fi
113119

114-
fi
120+
fi
121+
122+
if [ "$8" = true ] ; then
123+
124+
echo Running: vulture ${15} $1
125+
126+
vulture ${15} $1
127+
exit_code=$?
128+
129+
if [ "$exit_code" = "0" ]; then
130+
echo "vulture ok"
131+
else
132+
echo "vulture error"
133+
echo "::add-matcher::$(pwd)/.github/vulture.json"
134+
exit $exit_code
135+
fi
136+
137+
fi

0 commit comments

Comments
 (0)