Skip to content

Commit c68f5e0

Browse files
committed
feat: add support for autopep8
1 parent 3f0cfcd commit c68f5e0

File tree

4 files changed

+92
-60
lines changed

4 files changed

+92
-60
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Container image that runs your code
2-
FROM weibullguy/python-lint-image:1.8.0
2+
FROM weibullguy/python-lint-image:1.9.0
33

44
# Copies your code file from your action repository to the filesystem path `/` of the container
55
COPY entrypoint.sh /entrypoint.sh

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ This action may be used to execute the following applications:
1515
- [isort](https://github.com/timothycrosley/isort)
1616
- [docformatter](https://github.com/myint/docformatter)
1717
- [pycodestyle](https://pycodestyle.readthedocs.io)
18+
- [autopep8](https://github.com/hhatto/autopep8)
1819
- [pydocstyle](https://github.com/PyCQA/pydocstyle/)
1920
- [mypy](http://mypy-lang.org/)
2021
- [pylint](https://www.pylint.org/)
@@ -65,6 +66,7 @@ steps:
6566
use-isort: false
6667
use-docformatter: false
6768
use-pycodestyle: false
69+
use-autopep8: false
6870
use-pydocstyle: false
6971
use-mypy: false
7072
use-pylint: false
@@ -103,6 +105,8 @@ docformatter $(extra-docformatter-options) $(python-root-list)
103105

104106
pycodestyle $(extra-pycodestyle-options) $(python-root-list)
105107

108+
autopep8 $(extra-autopep8-options) $(python-root-list)
109+
106110
pydocstyle $(extra-pydocstyle-options) $(python-root-list)
107111

108112
mypy $(extra-mypy-options) $(python-root-list)

action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ inputs:
2525
description: "Use pycodestyle"
2626
required: false
2727
default: true
28+
use-autopep8:
29+
description: "Use autopep8"
30+
required: false
31+
default: false
2832
use-pydocstyle:
2933
description: "Use pydocstyle"
3034
required: false
@@ -81,6 +85,10 @@ inputs:
8185
description: "Extra options: pycodestyle $(extra-pycodestyle-options) $(python-root-list)"
8286
required: false
8387
default: ""
88+
extra-autopep8-options:
89+
description: "Extra options: autopep8 $(extra-autopep8-options) $(python-root-list)"
90+
required: false
91+
default: ""
8492
extra-pydocstyle-options:
8593
description: "Extra options: pydocstyle $(extra-pydocstyle-options) $(python-root-list)"
8694
required: false
@@ -128,6 +136,7 @@ runs:
128136
- ${{ inputs.use-isort }}
129137
- ${{ inputs.use-docformatter }}
130138
- ${{ inputs.use-pycodestyle }}
139+
- ${{ inputs.use-autopep8 }}
131140
- ${{ inputs.use-pydocstyle }}
132141
- ${{ inputs.use-mypy }}
133142
- ${{ inputs.use-pylint }}
@@ -142,6 +151,7 @@ runs:
142151
- ${{ inputs.extra-isort-options }}
143152
- ${{ inputs.extra-docformatter-options }}
144153
- ${{ inputs.extra-pycodestyle-options }}
154+
- ${{ inputs.extra-autopep8-options }}
145155
- ${{ inputs.extra-pydocstyle-options }}
146156
- ${{ inputs.extra-mypy-options }}
147157
- ${{ inputs.extra-pylint-options }}

entrypoint.sh

Lines changed: 77 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,38 @@
88
# $4 - use-isort
99
# $5 - use-docformatter
1010
# $6 - use-pycodestyle
11-
# $7 - use-pydocstyle
12-
# $8 - use-mypy
13-
# $9 - use-pylint
14-
# $10 - use-flake8
15-
# ${11} - use mccabe
16-
# ${12} - use radon
17-
# ${13} - use-rstcheck
18-
# ${14} - use-check-manifest
19-
# ${15} - use-pyroma
20-
# ${16} - extra-black-options
21-
# ${17} - extra-yapf-options
22-
# ${18} - extra-isort-options
23-
# ${19} - extra-docformatter-options
24-
# ${20} - extra-pycodestyle-options
25-
# ${21} - extra-pydocstyle-options
26-
# ${22} - extra-mypy-options
27-
# ${23} - extra-pylint-options
28-
# ${24} - extra-flake8-options
29-
# ${25} - extra-mccabe-options
30-
# ${26} - extra-radon-options
31-
# ${27} - extra-rstcheck-options
32-
# ${28} - extra-manifest-options
33-
# ${29} - extra-pyroma-options
11+
# #7 - use-autopep8
12+
# $8 - use-pydocstyle
13+
# $9 - use-mypy
14+
# $10 - use-pylint
15+
# ${11} - use-flake8
16+
# ${12} - use mccabe
17+
# ${13} - use radon
18+
# ${14} - use-rstcheck
19+
# ${15} - use-check-manifest
20+
# ${16} - use-pyroma
21+
# ${17} - extra-black-options
22+
# ${18} - extra-yapf-options
23+
# ${19} - extra-isort-options
24+
# ${20} - extra-docformatter-options
25+
# ${21} - extra-pycodestyle-options
26+
# ${22} - extra-autopep8-options
27+
# ${23} - extra-pydocstyle-options
28+
# ${24} - extra-mypy-options
29+
# ${25} - extra-pylint-options
30+
# ${26} - extra-flake8-options
31+
# ${27} - extra-mccabe-options
32+
# ${28} - extra-radon-options
33+
# ${29} - extra-rstcheck-options
34+
# ${30} - extra-manifest-options
35+
# ${31} - extra-pyroma-options
3436

3537
# Run the autoformatters first.
3638
if [ "$2" = true ] ; then
3739

38-
echo Running: black --check ${16} $1
40+
echo Running: black --check ${17} $1
3941

40-
black --check ${16} $1
42+
black --check ${17} $1
4143
exit_code=$?
4244

4345
if [ "$exit_code" = "0" ]; then
@@ -51,9 +53,9 @@ fi
5153

5254
if [ "$3" = true ]; then
5355

54-
echo Running: yapf ${17} $1
56+
echo Running: yapf ${18} $1
5557

56-
yapf ${17} $1
58+
yapf ${18} $1
5759
exit_code=$?
5860

5961
if [ "$exit_code" = "0" ]; then
@@ -67,9 +69,9 @@ fi
6769

6870
if [ "$4" = true ] ; then
6971

70-
echo Running: isort ${18} $1 -c --diff
72+
echo Running: isort ${19} $1 -c --diff
7173

72-
isort ${18} $1 -c --diff
74+
isort ${19} $1 -c --diff
7375
exit_code=$?
7476

7577
if [ "$exit_code" = "0" ]; then
@@ -83,9 +85,9 @@ fi
8385

8486
if [ "$5" = true ] ; then
8587

86-
echo Running: docformatter -c --recursive ${19} $1
88+
echo Running: docformatter -c --recursive ${20} $1
8789

88-
docformatter -c --recursive ${19} $1
90+
docformatter -c --recursive ${20} $1
8991
exit_code=$?
9092

9193
if [ "$exit_code" = "0" ]; then
@@ -101,9 +103,9 @@ fi
101103
# Then check the autoformatter results.
102104
if [ "$6" = true ] ; then
103105

104-
echo Running: pycodestyle ${20} $1
106+
echo Running: pycodestyle ${21} $1
105107

106-
pycodestyle ${20} $1
108+
pycodestyle ${21} $1
107109
exit_code=$?
108110

109111
if [ "$exit_code" = "0" ]; then
@@ -117,9 +119,25 @@ fi
117119

118120
if [ "$7" = true ] ; then
119121

120-
echo Running: pydocstyle ${21} $1
122+
echo Running: autopep8 ${22} $1
121123

122-
pydocstyle ${21} $1
124+
autopep8 ${22} $1
125+
exit_code=$?
126+
127+
if [ "$exit_code" = 0 ]; then
128+
echo "autopep8 ok"
129+
else
130+
echo "autopep8 error"
131+
echo $exit_code
132+
fi
133+
134+
fi
135+
136+
if [ "$8" = true ] ; then
137+
138+
echo Running: pydocstyle ${23} $1
139+
140+
pydocstyle ${23} $1
123141
exit_code=$?
124142

125143
if [ "$exit_code" = 0 ]; then
@@ -131,11 +149,11 @@ if [ "$7" = true ] ; then
131149
fi
132150

133151
# Next type check everything.
134-
if [ "$8" = true ] ; then
152+
if [ "$9" = true ] ; then
135153

136-
echo Running: mypy ${22} $1
154+
echo Running: mypy ${24} $1
137155

138-
mypy ${22} $1
156+
mypy ${24} $1
139157
exit_code=$?
140158

141159
if [ "$exit_code" = "0" ]; then
@@ -148,11 +166,11 @@ if [ "$8" = true ] ; then
148166
fi
149167

150168
# Finally, lint the code.
151-
if [ "$9" = true ] ; then
169+
if [ "${10}" = true ] ; then
152170

153-
echo Running: pylint ${23} $1
171+
echo Running: pylint ${25} $1
154172

155-
pylint ${23} $1
173+
pylint ${25} $1
156174
exit_code=$?
157175

158176
if [ "$exit_code" = "0" ]; then
@@ -164,11 +182,11 @@ if [ "$9" = true ] ; then
164182

165183
fi
166184

167-
if [ "${10}" = true ] ; then
185+
if [ "${11}" = true ] ; then
168186

169-
echo Running: flake8 ${24} $1
187+
echo Running: flake8 ${26} $1
170188

171-
flake8 ${24} $1
189+
flake8 ${26} $1
172190
exit_code=$?
173191

174192
if [ "$exit_code" = "0" ]; then
@@ -181,11 +199,11 @@ if [ "${10}" = true ] ; then
181199
fi
182200

183201
# Check code maintainability
184-
if [ "${11}" = true ]; then
202+
if [ "${12}" = true ]; then
185203

186-
echo Running: mccabe ${25} $1
204+
echo Running: mccabe ${27} $1
187205

188-
python -m mccabe ${25} $1
206+
python -m mccabe ${27} $1
189207
exit_code=$?
190208

191209
if [ "$exit_code" = "0" ]; then
@@ -196,11 +214,11 @@ if [ "${11}" = true ]; then
196214
fi
197215
fi
198216

199-
if [ "${12}" = true ]; then
217+
if [ "${13}" = true ]; then
200218

201-
echo Running: radon ${26} $1
219+
echo Running: radon ${28} $1
202220

203-
radon ${26} $1
221+
radon ${28} $1
204222
exit_code=$?
205223

206224
if [ "$exit_code" = "0" ]; then
@@ -212,11 +230,11 @@ if [ "${12}" = true ]; then
212230
fi
213231

214232
# Check rst files
215-
if [ "${13}" = true ]; then
233+
if [ "${14}" = true ]; then
216234

217-
echo Running: rstcheck ${27} $1
235+
echo Running: rstcheck ${29} $1
218236

219-
rstcheck ${27} $1
237+
rstcheck ${29} $1
220238
exit_code=$?
221239

222240
if [ "$exit_code" = "0" ]; then
@@ -228,11 +246,11 @@ if [ "${13}" = true ]; then
228246
fi
229247

230248
# Check packaging
231-
if [ "${14}" = true ]; then
249+
if [ "${15}" = true ]; then
232250

233-
echo Running: check-manifest ${28} .
251+
echo Running: check-manifest ${30} .
234252

235-
check-manifest ${28} .
253+
check-manifest ${30} .
236254
exit_code=$?
237255

238256
if [ "$exit_code" = "0" ]; then
@@ -243,11 +261,11 @@ if [ "${14}" = true ]; then
243261
fi
244262
fi
245263

246-
if [ "${15}" = true ]; then
264+
if [ "${16}" = true ]; then
247265

248-
echo Running: pyroma ${29} .
266+
echo Running: pyroma ${31} .
249267

250-
pyroma ${29} .
268+
pyroma ${31} .
251269
exit_code=$?
252270

253271
if [ "$exit_code" = "0" ]; then

0 commit comments

Comments
 (0)