Skip to content

Commit de17a97

Browse files
committed
feat: allow user to set tool versions
1 parent c29f786 commit de17a97

File tree

5 files changed

+253
-87
lines changed

5 files changed

+253
-87
lines changed

.github/workflows/all-lints.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ jobs:
1414
use-check-manifest: false
1515
use-pyroma: false
1616
extra-rstcheck-options: "-r"
17+
docformatter-version: "==1.5.0"

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.10.0
2+
FROM python:3.10-alpine3.16
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: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,17 @@ recommended that the tools you use in this action be used in-line with your
3131
editor or IDE and/or as pre-commit hooks. This action just verifies you didn't
3232
forget to do that.
3333

34-
However, you could choose to have fixes applied by each tool. If you do, it's
35-
recommended that the autoformatters come first, followed by the style checking
36-
tools to verify the autoformatter results. After this, the type checkers and
37-
linters can be run.
38-
3934
All tools are enabled by default with the exception of black and yapf. It's
4035
certainly your prerogative to use as many autoformatters as you'd like, but I
4136
recommend using only one. Which you choose should be enabled with the
4237
use-black or use-yapf input.
4338

39+
Each run of the action creates a virtual environment. Each of the enabled
40+
tools is installed in this virtual environment before that tool is executed.
41+
The default name of the virtual environment is ```python-lint-plus```, but you
42+
can set it to whatever you'd like with the ```virtual-env``` option.
43+
This can be helpful if your running a matrix of various versions of python.
44+
4445
## Usage
4546

4647
See [action.yml](action.yml)
@@ -61,21 +62,37 @@ steps:
6162
- uses: weibullguy/python-lint-plus@master
6263
with:
6364
python-root-list: "tests"
65+
virtual-env: "python-lint-plus"
6466
use-black: false
67+
black-version:
6568
use-yapf: false
69+
yapf-version:
6670
use-isort: false
71+
isort-version:
6772
use-docformatter: false
73+
docformatter-version:
6874
use-pycodestyle: false
75+
pycodestyle-version:
6976
use-autopep8: false
77+
autopep8-version:
7078
use-pydocstyle: false
79+
pydocstyle-version:
7180
use-mypy: false
81+
mypy-version:
7282
use-pylint: false
83+
pylint-version:
7384
use-flake8: false
85+
flake8-version:
7486
use-mccabe: false
87+
mccabe-version:
7588
use-radon: false
89+
radon-version:
7690
use-rstcheck: false
91+
rstcheck-version:
7792
use-check-manifest: false
93+
check-manifest-version:
7894
use-pyroma: false
95+
pyroma-version:
7996
extra-black-options: ""
8097
extra-yapf-options: ""
8198
extra-isort-options: ""
@@ -136,17 +153,36 @@ steps:
136153
- uses: actions/checkout@v2
137154
- uses: weibullguy/python-lint-plus@master
138155
with:
139-
python-root-list: "python_alelo tests"
156+
python-root-list: "tests"
157+
virtual-environment: "python-lint-plus"
140158
use-radon: true
141159
extra-radon-options: "cc -s"
142160
```
143161
144162
To run multiple radon checks, you'll need to add a step for each in your
145163
workflow file.
146164
147-
## Versions used
165+
## Tool Versions Used
148166
149-
To identify the version used you must consult the [CHANGELOG.md](https://github.com/weibullguy/python-lint-image/blob/master/CHANGELOG.md) of the image used in the [Dockerfile](Dockerfile).
167+
If the version input is left unset, the action will use the latest version of
168+
the tool available on PyPi. In the following example action.yml, the
169+
docformatter version used will be 1.5.0, the isort version used will be the
170+
latest available on PyPi, and the pydocstyle version used will be the latest
171+
available on PyPi with a version number greater than or equal to 6.1.0.
172+
173+
```yml
174+
steps:
175+
- uses: actions/checkout@v2
176+
- uses: weibullguy/python-lint-plus@master
177+
with:
178+
python-root-list: "tests"
179+
virtual-env: "python-lint-plus"
180+
use-docformatter: true
181+
docformatter-version: "==1.5.0"
182+
use-isort: true
183+
use-pydocstyle: true
184+
pydocstyle-version: ">=6.1.0"
185+
```
150186
151187
## License
152188

action.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,66 +5,130 @@ inputs:
55
description: "A list of all paths to test"
66
required: false
77
default: "."
8+
virtual-env:
9+
description: "The name of the virtual environment to use for running the tools"
10+
required: false
11+
default: "python-lint-plus"
812
use-black:
913
description: "Use Black"
1014
required: false
1115
default: false
16+
black-version:
17+
description: "The version of black to use"
18+
required: false
19+
default: ""
1220
use-yapf:
1321
description: "Use yapf"
1422
required: false
1523
default: false
24+
yapf-version:
25+
description: "The version of yapf to use"
26+
required: false
27+
default: ""
1628
use-isort:
1729
description: "Use isort"
1830
required: false
1931
default: true
32+
isort-version:
33+
description: "The version of isort to use"
34+
required: false
35+
default: ""
2036
use-docformatter:
2137
description: "Use docformatter"
2238
required: false
2339
default: true
40+
docformatter-version:
41+
description: "The version of docformatter to use"
42+
required: false
43+
default: ""
2444
use-pycodestyle:
2545
description: "Use pycodestyle"
2646
required: false
2747
default: true
48+
pycodestyle-version:
49+
description: "The version of pycodestyle to use"
50+
required: false
51+
default: ""
2852
use-autopep8:
2953
description: "Use autopep8"
3054
required: false
3155
default: false
56+
autopep8-version:
57+
description: "The version of autope8 to use"
58+
required: false
59+
default: ""
3260
use-pydocstyle:
3361
description: "Use pydocstyle"
3462
required: false
3563
default: true
64+
pydocstyle-version:
65+
description: "The version of pydocstyle to use"
66+
required: false
67+
default: ""
3668
use-mypy:
3769
description: "Use mypy"
3870
required: false
3971
default: true
72+
mypy-version:
73+
description: "The version of mypy to use"
74+
required: false
75+
default: ""
4076
use-pylint:
4177
description: "Use Pylint"
4278
required: false
4379
default: true
80+
pylint-version:
81+
description: "The version of pylint to use"
82+
required: false
83+
default: ""
4484
use-flake8:
4585
description: "Use Flake8"
4686
required: false
4787
default: true
88+
flake8-version:
89+
description: "The version of flake8 to use"
90+
required: false
91+
default: ""
4892
use-mccabe:
4993
description: "Use mccabe"
5094
required: false
5195
default: false
96+
mccabe-version:
97+
description: "The version of mccabe to use"
98+
required: false
99+
default: ""
52100
use-radon:
53101
description: "Use radon"
54102
required: false
55103
default: false
104+
radon-version:
105+
description: "The version of radon to use"
106+
required: false
107+
default: ""
56108
use-rstcheck:
57109
description: "Use rstcheck"
58110
required: false
59111
default: true
112+
rstcheck-version:
113+
description: "The version of rstcheck to use"
114+
required: false
115+
default: ""
60116
use-check-manifest:
61117
description: "Use check-manifest"
62118
required: false
63119
default: true
120+
check-manifest-version:
121+
description: "The version of check-manifest to use"
122+
required: false
123+
default: ""
64124
use-pyroma:
65125
description: "Use pyroma"
66126
required: false
67127
default: true
128+
pyroma-version:
129+
description: "The version of pyroma to use"
130+
required: false
131+
default: ""
68132
extra-black-options:
69133
description: "Extra options: black --check $(extra-black-options) $(python-root-list)"
70134
required: false
@@ -131,21 +195,37 @@ runs:
131195
image: "Dockerfile"
132196
args:
133197
- ${{ inputs.python-root-list }}
198+
- ${{ inputs.virtual-env }}
134199
- ${{ inputs.use-black }}
200+
- ${{ inputs.black-version }}
135201
- ${{ inputs.use-yapf }}
202+
- ${{ inputs.yapf-version }}
136203
- ${{ inputs.use-isort }}
204+
- ${{ inputs.isort-version }}
137205
- ${{ inputs.use-docformatter }}
206+
- ${{ inputs.docformatter-version }}
138207
- ${{ inputs.use-pycodestyle }}
208+
- ${{ inputs.pycodestyle-version }}
139209
- ${{ inputs.use-autopep8 }}
210+
- ${{ inputs.autopep8-version }}
140211
- ${{ inputs.use-pydocstyle }}
212+
- ${{ inputs.pydocstyle-version }}
141213
- ${{ inputs.use-mypy }}
214+
- ${{ inputs.mypy-version }}
142215
- ${{ inputs.use-pylint }}
216+
- ${{ inputs.pylint-version }}
143217
- ${{ inputs.use-flake8 }}
218+
- ${{ inputs.flake8-version }}
144219
- ${{ inputs.use-mccabe }}
220+
- ${{ inputs.mccabe-version }}
145221
- ${{ inputs.use-radon }}
222+
- ${{ inputs.radon-version }}
146223
- ${{ inputs.use-rstcheck }}
224+
- ${{ inputs.rstcheck-version }}
147225
- ${{ inputs.use-check-manifest }}
226+
- ${{ inputs.check-manifest-version }}
148227
- ${{ inputs.use-pyroma }}
228+
- ${{ inputs.pyroma-version }}
149229
- ${{ inputs.extra-black-options }}
150230
- ${{ inputs.extra-yapf-options }}
151231
- ${{ inputs.extra-isort-options }}

0 commit comments

Comments
 (0)