diff --git a/README.md b/README.md index 06addec..e644206 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Basic: ```yml steps: - uses: actions/checkout@v2 - - uses: weibullguy/python-lint-plus@master + - uses: weibullguy/python-lint-plus@v1.11.0 ``` Options: @@ -59,7 +59,7 @@ Options: ```yml steps: - uses: actions/checkout@v2 - - uses: weibullguy/python-lint-plus@master + - uses: weibullguy/python-lint-plus@v1.11.0 with: python-root-list: "tests" virtual-env: "python-lint-plus" @@ -151,7 +151,7 @@ the files. ```yml steps: - uses: actions/checkout@v2 - - uses: weibullguy/python-lint-plus@master + - uses: weibullguy/python-lint-plus@v1.11.0 with: python-root-list: "tests" virtual-environment: "python-lint-plus" @@ -173,7 +173,7 @@ available on PyPi with a version number greater than or equal to 6.1.0. ```yml steps: - uses: actions/checkout@v2 - - uses: weibullguy/python-lint-plus@master + - uses: weibullguy/python-lint-plus@v1.11.0 with: python-root-list: "tests" virtual-env: "python-lint-plus" diff --git a/action.yml b/action.yml index 8506d5b..7f4d04b 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,8 @@ name: "Python Code Style, Quality, and Lint" description: "Supports a plethora of tools for checking your Python code and packages" +branding: + icon: "terminal" + color: "white" inputs: python-root-list: description: "A list of all paths to test" @@ -134,7 +137,7 @@ inputs: required: false default: "" extra-yapf-options: - description: "Extra options: yapf $(extra-yapf-optsion) $(python-root-list)" + description: "Extra options: yapf $(extra-yapf-options) $(python-root-list)" required: false default: "" extra-isort-options: @@ -189,58 +192,75 @@ inputs: description: "Extra options: pyroma $(extra-manifest-options) ." required: false default: "" + python-version: + description: "Python version to use for the run. Defaults to 3.10." + required: false + default: '3.10' + architecture: + description: "The architecture (x86 or x64) to use for the run. Defaults to x64." + required: false + default: 'x64' runs: - using: "docker" - image: "Dockerfile" - args: - - ${{ inputs.python-root-list }} - - ${{ inputs.virtual-env }} - - ${{ inputs.use-black }} - - ${{ inputs.black-version }} - - ${{ inputs.use-yapf }} - - ${{ inputs.yapf-version }} - - ${{ inputs.use-isort }} - - ${{ inputs.isort-version }} - - ${{ inputs.use-docformatter }} - - ${{ inputs.docformatter-version }} - - ${{ inputs.use-pycodestyle }} - - ${{ inputs.pycodestyle-version }} - - ${{ inputs.use-autopep8 }} - - ${{ inputs.autopep8-version }} - - ${{ inputs.use-pydocstyle }} - - ${{ inputs.pydocstyle-version }} - - ${{ inputs.use-mypy }} - - ${{ inputs.mypy-version }} - - ${{ inputs.use-pylint }} - - ${{ inputs.pylint-version }} - - ${{ inputs.use-flake8 }} - - ${{ inputs.flake8-version }} - - ${{ inputs.use-mccabe }} - - ${{ inputs.mccabe-version }} - - ${{ inputs.use-radon }} - - ${{ inputs.radon-version }} - - ${{ inputs.use-rstcheck }} - - ${{ inputs.rstcheck-version }} - - ${{ inputs.use-check-manifest }} - - ${{ inputs.check-manifest-version }} - - ${{ inputs.use-pyroma }} - - ${{ inputs.pyroma-version }} - - ${{ inputs.extra-black-options }} - - ${{ inputs.extra-yapf-options }} - - ${{ inputs.extra-isort-options }} - - ${{ inputs.extra-docformatter-options }} - - ${{ inputs.extra-pycodestyle-options }} - - ${{ inputs.extra-autopep8-options }} - - ${{ inputs.extra-pydocstyle-options }} - - ${{ inputs.extra-mypy-options }} - - ${{ inputs.extra-pylint-options }} - - ${{ inputs.extra-flake8-options }} - - ${{ inputs.extra-mccabe-options }} - - ${{ inputs.extra-radon-options }} - - ${{ inputs.extra-rstcheck-options }} - - ${{ inputs.extra-manifest-options }} - - ${{ inputs.extra-pyroma-options }} -branding: - icon: "terminal" - color: "white" + using: "composite" + steps: + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: ${{ inputs.python-version }} + architecture: ${{ inputs.architecture }} + cache: pip + + - name: Linux Lint + if: ${{ runner.os == 'Linux' }} + run: > + ${{ github.action_path }}/entrypoint.sh + '${{ inputs.python-root-list }}' + '${{ inputs.virtual-env }}' + ${{ inputs.use-black }} + ${{ inputs.black-version }} + ${{ inputs.use-yapf }} + ${{ inputs.yapf-version }} + ${{ inputs.use-isort }} + ${{ inputs.isort-version }} + ${{ inputs.use-docformatter }} + ${{ inputs.docformatter-version }} + ${{ inputs.use-pycodestyle }} + ${{ inputs.pycodestyle-version }} + ${{ inputs.use-autopep8 }} + ${{ inputs.autopep8-version }} + ${{ inputs.use-pydocstyle }} + ${{ inputs.pydocstyle-version }} + ${{ inputs.use-mypy }} + ${{ inputs.mypy-version }} + ${{ inputs.use-pylint }} + ${{ inputs.pylint-version }} + ${{ inputs.use-flake8 }} + ${{ inputs.flake8-version }} + ${{ inputs.use-mccabe }} + ${{ inputs.mccabe-version }} + ${{ inputs.use-radon }} + ${{ inputs.radon-version }} + ${{ inputs.use-rstcheck }} + ${{ inputs.rstcheck-version }} + ${{ inputs.use-check-manifest }} + ${{ inputs.check-manifest-version }} + ${{ inputs.use-pyroma }} + ${{ inputs.pyroma-version }} + '${{ inputs.extra-black-options }}' + '${{ inputs.extra-yapf-options }}' + '${{ inputs.extra-isort-options }}' + '${{ inputs.extra-docformatter-options }}' + '${{ inputs.extra-pycodestyle-options }}' + '${{ inputs.extra-autopep8-options }}' + '${{ inputs.extra-pydocstyle-options }}' + '${{ inputs.extra-mypy-options }}' + '${{ inputs.extra-pylint-options }}' + '${{ inputs.extra-flake8-options }}' + '${{ inputs.extra-mccabe-options }}' + '${{ inputs.extra-radon-options }}' + '${{ inputs.extra-rstcheck-options }}' + '${{ inputs.extra-manifest-options }}' + '${{ inputs.extra-pyroma-options }}' + shell: bash + diff --git a/entrypoint.sh b/entrypoint.sh index d6d41e8..d81edea 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -49,6 +49,30 @@ # ${45} - extra-rstcheck-options # ${46} - extra-manifest-options # ${47} - extra-pyroma-options +# ${48} - python-version +# ${49) - architecture + +# actions path has the copy of this actions repo +echo $RUNNER_OS +if [ $RUNNER_OS = 'Windows' ] +then + MATCHERS=$GITHUB_ACTION_PATH\matchers\*.json +else + MATCHERS=$GITHUB_ACTION_PATH/matchers/*.json +fi +echo $MATCHERS + +for matcher in $MATCHERS +do + echo Adding matcher $matcher + echo "::add-matcher::${matcher}" +done +echo "TERM: changing from $TERM -> xterm" +export TERM=xterm + +# Get the python version and architecture to use for this run. +python-version=${48} +architecture=${49} # Create a virtual environment to run tools. echo "Creating virtual environment: $2" diff --git a/matchers/autopep8.json b/matchers/autopep8.json new file mode 100644 index 0000000..e69de29 diff --git a/matchers/autopep8_severity.json b/matchers/autopep8_severity.json new file mode 100644 index 0000000..e69de29 diff --git a/matchers/black.json b/matchers/black.json new file mode 100644 index 0000000..00d1aff --- /dev/null +++ b/matchers/black.json @@ -0,0 +1,18 @@ +{ + "problemMatcher": [ + { + "severity": "warning", + "column": 1, + "line": 1, + "code": "W", + "pattern": [ + { + "regexp": "^(would reformat) (.*)$", + "file": 2, + "message": 1 + } + ], + "owner": "black" + } + ] +} diff --git a/matchers/black_severity.json b/matchers/black_severity.json new file mode 100644 index 0000000..d2af053 --- /dev/null +++ b/matchers/black_severity.json @@ -0,0 +1,18 @@ +{ + "problemMatcher": [ + { + "column": 1, + "line": 1, + "code": "W", + "pattern": [ + { + "regexp": "^#{0,2}\\[([a-z]*)\\](would reformat) (.*)$", + "severity": 1, + "file": 3, + "message": 2 + } + ], + "owner": "black_severity" + } + ] +} diff --git a/matchers/check-manifest.json b/matchers/check-manifest.json new file mode 100644 index 0000000..e69de29 diff --git a/matchers/check-manifest_severity.json b/matchers/check-manifest_severity.json new file mode 100644 index 0000000..e69de29 diff --git a/matchers/docformatter.json b/matchers/docformatter.json new file mode 100644 index 0000000..e69de29 diff --git a/matchers/docformatter_severity.json b/matchers/docformatter_severity.json new file mode 100644 index 0000000..e69de29 diff --git a/matchers/flake8.json b/matchers/flake8.json new file mode 100644 index 0000000..aa0f342 --- /dev/null +++ b/matchers/flake8.json @@ -0,0 +1,18 @@ +{ + "problemMatcher": [ + { + "severity": "warning", + "pattern": [ + { + "regexp": "(\\S+):(\\d+):(\\d+): ([A-Z]\\d+) (.*)", + "file": 1, + "line": 2, + "column": 3, + "code": 4, + "message": 5 + } + ], + "owner": "flake8" + } + ] +} diff --git a/matchers/flake8_severity.json b/matchers/flake8_severity.json new file mode 100644 index 0000000..69ef267 --- /dev/null +++ b/matchers/flake8_severity.json @@ -0,0 +1,18 @@ +{ + "problemMatcher": [ + { + "pattern": [ + { + "regexp": "^##\\[([a-z]+)\\](\\S+):(\\d+):(\\d+): ([A-Z]\\d+) (.*)", + "severity": 1, + "file": 2, + "line": 3, + "column": 4, + "code": 5, + "message": 6 + } + ], + "owner": "flake8_severity" + } + ] +} diff --git a/matchers/isort.json b/matchers/isort.json new file mode 100644 index 0000000..4d6e1f7 --- /dev/null +++ b/matchers/isort.json @@ -0,0 +1,15 @@ +{ + "problemMatcher": [ + { + "pattern": [ + { + "regexp": "^(\\S*): (\\S*) (.*)$", + "file": 2, + "severity": 1, + "message": 3 + } + ], + "owner": "isort" + } + ] + } diff --git a/matchers/isort_severity.json b/matchers/isort_severity.json new file mode 100644 index 0000000..4a56e51 --- /dev/null +++ b/matchers/isort_severity.json @@ -0,0 +1,15 @@ +{ + "problemMatcher": [ + { + "pattern": [ + { + "regexp": "^#{0,2}\\[([a-z]*)\\](\\S*): (\\S*) (.*)$", + "file": 3, + "severity": 1, + "message": 4 + } + ], + "owner": "isort_severity" + } + ] + } diff --git a/matchers/mccabe.json b/matchers/mccabe.json new file mode 100644 index 0000000..e69de29 diff --git a/matchers/mccabe_severity.json b/matchers/mccabe_severity.json new file mode 100644 index 0000000..e69de29 diff --git a/matchers/mypy.json b/matchers/mypy.json new file mode 100644 index 0000000..1c6d7b2 --- /dev/null +++ b/matchers/mypy.json @@ -0,0 +1,18 @@ +{ + "problemMatcher": [ + { + "code": "E", + "pattern": [ + { + "regexp": "^(\\S*):(\\d+):(\\d+): ([a-z]+): (.*)$", + "file": 1, + "column": 3, + "line": 2, + "severity": 4, + "message": 5 + } + ], + "owner": "mypy" + } + ] +} diff --git a/matchers/mypy_severity.json b/matchers/mypy_severity.json new file mode 100644 index 0000000..4547d8b --- /dev/null +++ b/matchers/mypy_severity.json @@ -0,0 +1,18 @@ +{ + "problemMatcher": [ + { + "code": "E", + "pattern": [ + { + "regexp": "^#{0,2}\\[([a-z]*)\\](\\S*)(\\d+):(\\d+): ([a-z]+): (.*)$", + "file": 2, + "column": 4, + "line": 3, + "severity": 1, + "message": 6 + } + ], + "owner": "mypy_severity" + } + ] +} diff --git a/matchers/pycodestyle.json b/matchers/pycodestyle.json new file mode 100644 index 0000000..61d366a --- /dev/null +++ b/matchers/pycodestyle.json @@ -0,0 +1,18 @@ +{ + "problemMatcher": [ + { + "severity": "warning", + "pattern": [ + { + "regexp": "^(\\S*):(\\d+):(\\d+): ([A-Z]\\d+) (.*)$", + "file": 1, + "line": 2, + "column": 3, + "code": 4, + "message": 5 + } + ], + "owner": "pycodestyle" + } + ] +} diff --git a/matchers/pycodestyle_severity.json b/matchers/pycodestyle_severity.json new file mode 100644 index 0000000..940639e --- /dev/null +++ b/matchers/pycodestyle_severity.json @@ -0,0 +1,18 @@ +{ + "problemMatcher": [ + { + "pattern": [ + { + "regexp": "^##\\[([a-z]*)\\](\\S*):(\\d+):(\\d+): ([A-Z]\\d+) (.*)$", + "severity": 1, + "file": 2, + "line": 3, + "column": 4, + "code": 5, + "message": 6 + } + ], + "owner": "pycodestyle_severity" + } + ] +} diff --git a/matchers/pydocstyle.json b/matchers/pydocstyle.json new file mode 100644 index 0000000..3ad35c1 --- /dev/null +++ b/matchers/pydocstyle.json @@ -0,0 +1,21 @@ +{ + "problemMatcher": [ + { + "severity": "warning", + "column": 1, + "pattern": [ + { + "regexp": "^(\\S*):(\\d*) .*", + "file": 1, + "line": 2 + }, + { + "regexp": "\\s*(D\\d*): (.*)$", + "message": 2, + "code": 1 + } + ], + "owner": "pydocstyle" + } + ] +} diff --git a/matchers/pydocstyle_severity.json b/matchers/pydocstyle_severity.json new file mode 100644 index 0000000..17eed9c --- /dev/null +++ b/matchers/pydocstyle_severity.json @@ -0,0 +1,21 @@ +{ + "problemMatcher": [ + { + "column": 1, + "pattern": [ + { + "regexp": "^(\\S*):(\\d*) .*", + "file": 1, + "line": 2 + }, + { + "regexp": "^##\\[([a-z]*)\\]\\s*(D\\d*): (.*)$", + "severity": 1, + "message": 3, + "code": 2 + } + ], + "owner": "pydocstyle_severity" + } + ] +} diff --git a/matchers/pylint-error.json b/matchers/pylint-error.json new file mode 100644 index 0000000..ee26f0e --- /dev/null +++ b/matchers/pylint-error.json @@ -0,0 +1,18 @@ +{ + "problemMatcher": [ + { + "severity": "error", + "pattern": [ + { + "regexp": "^([^:]+):(\\d+):(\\d+): (E\\d+): \\033\\[[\\d;]+m([^\\033]+).*$", + "file": 1, + "line": 2, + "column": 3, + "code": 4, + "message": 5 + } + ], + "owner": "pylint-error" + } + ] +} diff --git a/matchers/pylint-warning.json b/matchers/pylint-warning.json new file mode 100644 index 0000000..afe20df --- /dev/null +++ b/matchers/pylint-warning.json @@ -0,0 +1,18 @@ +{ + "problemMatcher": [ + { + "severity": "warning", + "pattern": [ + { + "regexp": "^([^:]+):(\\d+):(\\d+): ([A-DF-Z]\\d+): \\033\\[[\\d;]+m([^\\033]+).*$", + "file": 1, + "line": 2, + "column": 3, + "code": 4, + "message": 5 + } + ], + "owner": "pylint-warning" + } + ] +} diff --git a/matchers/pyroma.json b/matchers/pyroma.json new file mode 100644 index 0000000..e69de29 diff --git a/matchers/pyroma_severity.json b/matchers/pyroma_severity.json new file mode 100644 index 0000000..e69de29 diff --git a/matchers/radon.json b/matchers/radon.json new file mode 100644 index 0000000..e69de29 diff --git a/matchers/radon_severity.json b/matchers/radon_severity.json new file mode 100644 index 0000000..e69de29 diff --git a/matchers/rstcheck.json b/matchers/rstcheck.json new file mode 100644 index 0000000..e69de29 diff --git a/matchers/rstcheck_severity.json b/matchers/rstcheck_severity.json new file mode 100644 index 0000000..e69de29 diff --git a/matchers/yapf.json b/matchers/yapf.json new file mode 100644 index 0000000..e69de29 diff --git a/matchers/yapf_severity.json b/matchers/yapf_severity.json new file mode 100644 index 0000000..e69de29