Skip to content

Commit d0a3d57

Browse files
Feature/extra options and log (#3)
* more logs * extra options for all libs
1 parent fd57586 commit d0a3d57

File tree

3 files changed

+100
-18
lines changed

3 files changed

+100
-18
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,28 @@ steps:
3939
use-black: false
4040
use-mypy: false
4141
use-isort: false
42+
extra-pylint-options: ""
43+
extra-pycodestyle-options: ""
44+
extra-flake8-options: ""
45+
extra-black-options: ""
46+
extra-mypy-options: ""
47+
extra-isort-options: ""
48+
```
49+
50+
Command build logic list:
51+
52+
```bash
53+
pylint $(extra-pylint-options) $(python-root-list)
54+
55+
pycodestyle $(extra-pycodestyle-options) $(python-root-list)
56+
57+
flake8 $(extra-flake8-options) $(python-root-list)
58+
59+
black --check $(extra-black-options) $(python-root-list)
60+
61+
mypy $(extra-mypy-options) $(python-root-list)"
62+
63+
isort -rc $(extra-isort-options) $(python-root-list) -c --diff
4264
```
4365

4466
## License

action.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,32 @@ inputs:
2929
description: "Use isort"
3030
required: false
3131
default: true
32+
extra-pylint-options:
33+
description: "Extra options: pylint $(extra-pylint-options) $(python-root-list)"
34+
required: false
35+
default: ""
36+
extra-pycodestyle-options:
37+
description: "Extra options: pycodestyle $(extra-pycodestyle-options) $(python-root-list)"
38+
required: false
39+
default: ""
40+
extra-flake8-options:
41+
description: "Extra options: flake8 $(extra-flake8-options) $(python-root-list)"
42+
required: false
43+
default: ""
44+
extra-black-options:
45+
description: "Extra options: black --check $(extra-black-options) $(python-root-list)"
46+
required: false
47+
default: ""
48+
extra-mypy-options:
49+
description: "Extra options: mypy $(extra-mypy-options) $(python-root-list)"
50+
required: false
51+
default: ""
52+
extra-isort-options:
53+
description: "Extra options: isort -rc $(extra-isort-options) $(python-root-list) -c --diff "
54+
required: false
55+
default: ""
56+
57+
3258
runs:
3359
using: "docker"
3460
image: "Dockerfile"
@@ -40,3 +66,9 @@ runs:
4066
- ${{ inputs.use-black }}
4167
- ${{ inputs.use-mypy }}
4268
- ${{ inputs.use-isort }}
69+
- ${{ inputs.extra-pylint-options }}
70+
- ${{ inputs.extra-pycodestyle-options }}
71+
- ${{ inputs.extra-flake8-options }}
72+
- ${{ inputs.extra-black-options }}
73+
- ${{ inputs.extra-mypy-options }}
74+
- ${{ inputs.extra-isort-options }}

entrypoint.sh

Lines changed: 46 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,32 @@
11
#!/bin/sh -l
22

3+
# Parameters
4+
#
5+
# $1 - python-root-list
6+
# $2 - use-pylint
7+
# $3 - use-pycodestyle
8+
# $4 - use-flake8
9+
# $5 - use-black
10+
# $6 - use-mypy
11+
# $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
18+
319
if [ "$2" = true ] ; then
420

5-
pylint $1
21+
echo Running: pylint $8 $1
22+
23+
pylint $8 $1
624
exit_code=$?
725

826
if [ "$exit_code" = "0" ]; then
9-
echo ::log-command ::"Pylint ok"
27+
echo "Pylint ok"
1028
else
11-
echo ::error :: "Pylint error"
29+
echo "Pylint error"
1230
exit $exit_code
1331
fi
1432

@@ -17,69 +35,79 @@ fi
1735

1836
if [ "$3" = true ] ; then
1937

20-
pycodestyle $1
38+
echo Running: pycodestyle $9 $1
39+
40+
pycodestyle $9 $1
2141
exit_code=$?
2242

2343
if [ "$exit_code" = "0" ]; then
24-
echo ::log-command ::"pycodestyle ok"
44+
echo "pycodestyle ok"
2545
else
26-
echo ::error :: "pycodestyle error"
46+
echo "pycodestyle error"
2747
exit $exit_code
2848
fi
2949

3050
fi
3151

3252
if [ "$4" = true ] ; then
3353

34-
flake8 $1
54+
echo Running: flake8 ${10} $1
55+
56+
flake8 ${10} $1
3557
exit_code=$?
3658

3759
if [ "$exit_code" = "0" ]; then
38-
echo ::log-command ::"Flake8 ok"
60+
echo "Flake8 ok"
3961
else
40-
echo ::error :: "Flake8 error"
62+
echo "Flake8 error"
4163
exit $exit_code
4264
fi
4365

4466
fi
4567

4668
if [ "$5" = true ] ; then
4769

48-
black --check $1
70+
echo Running: black --check ${11} $1
71+
72+
black --check ${11} $1
4973
exit_code=$?
5074

5175
if [ "$exit_code" = "0" ]; then
52-
echo ::log-command ::"Black ok"
76+
echo "Black ok"
5377
else
54-
echo ::error :: "Black error"
78+
echo "Black error"
5579
exit $exit_code
5680
fi
5781

5882
fi
5983

6084
if [ "$6" = true ] ; then
6185

62-
mypy $1
86+
echo Running: mypy ${12} $1
87+
88+
mypy ${12} $1
6389
exit_code=$?
6490

6591
if [ "$exit_code" = "0" ]; then
66-
echo ::log-command ::"mypy ok"
92+
echo "mypy ok"
6793
else
68-
echo ::error :: "mypy error"
94+
echo "mypy error"
6995
exit $exit_code
7096
fi
7197

7298
fi
7399

74100
if [ "$7" = true ] ; then
75101

76-
isort -rc $1 -c --diff
102+
echo Running: isort -rc ${13} $1 -c --diff
103+
104+
isort -rc ${13} $1 -c --diff
77105
exit_code=$?
78106

79107
if [ "$exit_code" = "0" ]; then
80-
echo ::log-command ::"isort ok"
108+
echo "isort ok"
81109
else
82-
echo ::error :: "isort error"
110+
echo "isort error"
83111
exit $exit_code
84112
fi
85113

0 commit comments

Comments
 (0)