Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ Basic:
```yml
steps:
- uses: actions/checkout@v2
- uses: weibullguy/python-lint-plus@master
- uses: weibullguy/python-lint-plus@v1.11.0
```

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"
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down
128 changes: 74 additions & 54 deletions action.yml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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

24 changes: 24 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Empty file added matchers/autopep8.json
Empty file.
Empty file added matchers/autopep8_severity.json
Empty file.
18 changes: 18 additions & 0 deletions matchers/black.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"problemMatcher": [
{
"severity": "warning",
"column": 1,
"line": 1,
"code": "W",
"pattern": [
{
"regexp": "^(would reformat) (.*)$",
"file": 2,
"message": 1
}
],
"owner": "black"
}
]
}
18 changes: 18 additions & 0 deletions matchers/black_severity.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
Empty file added matchers/check-manifest.json
Empty file.
Empty file.
Empty file added matchers/docformatter.json
Empty file.
Empty file.
18 changes: 18 additions & 0 deletions matchers/flake8.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
18 changes: 18 additions & 0 deletions matchers/flake8_severity.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
15 changes: 15 additions & 0 deletions matchers/isort.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"problemMatcher": [
{
"pattern": [
{
"regexp": "^(\\S*): (\\S*) (.*)$",
"file": 2,
"severity": 1,
"message": 3
}
],
"owner": "isort"
}
]
}
15 changes: 15 additions & 0 deletions matchers/isort_severity.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"problemMatcher": [
{
"pattern": [
{
"regexp": "^#{0,2}\\[([a-z]*)\\](\\S*): (\\S*) (.*)$",
"file": 3,
"severity": 1,
"message": 4
}
],
"owner": "isort_severity"
}
]
}
Empty file added matchers/mccabe.json
Empty file.
Empty file added matchers/mccabe_severity.json
Empty file.
18 changes: 18 additions & 0 deletions matchers/mypy.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
18 changes: 18 additions & 0 deletions matchers/mypy_severity.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
18 changes: 18 additions & 0 deletions matchers/pycodestyle.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
18 changes: 18 additions & 0 deletions matchers/pycodestyle_severity.json
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
Loading