mirror of
https://github.com/esphome/aioesphomeapi.git
synced 2024-12-21 16:37:41 +01:00
Refactor Lint Configs (#53)
This commit is contained in:
parent
2629e8d86c
commit
f11f6e0122
102
.github/workflows/ci.yml
vendored
102
.github/workflows/ci.yml
vendored
@ -6,80 +6,60 @@ on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
pylint:
|
||||
ci:
|
||||
name: ${{ matrix.name }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- id: flake8
|
||||
name: Lint with flake8
|
||||
- id: pylint
|
||||
name: Lint with pylint
|
||||
- id: black
|
||||
name: Check formatting with black
|
||||
- id: isort
|
||||
name: Check import order with isort
|
||||
- id: mypy
|
||||
name: Check typing with mypy
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
id: python
|
||||
with:
|
||||
python-version: '3.7'
|
||||
- name: Set up Python environment
|
||||
|
||||
- name: Get pip cache dir
|
||||
id: pip-cache
|
||||
run: |
|
||||
pip3 install -e .
|
||||
pip3 install -r requirements_test.txt
|
||||
- name: Register problem matcher
|
||||
run: |
|
||||
echo "::add-matcher::.github/workflows/matchers/pylint.json"
|
||||
- run: pylint aioesphomeapi
|
||||
flake8:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
echo "::set-output name=dir::$(pip cache dir)"
|
||||
- name: Restore PIP cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
python-version: '3.7'
|
||||
path: ${{ steps.pip-cache.outputs.dir }}
|
||||
key: pip-${{ steps.python.outputs.python-version }}-${{ hashFiles('requirements.txt', 'requirements_test.txt') }}
|
||||
restore-keys: |
|
||||
pip-${{ steps.python.outputs.python-version }}-
|
||||
- name: Set up Python environment
|
||||
run: |
|
||||
pip3 install -r requirements.txt -r requirements_test.txt
|
||||
pip3 install -e .
|
||||
pip3 install -r requirements_test.txt
|
||||
- name: Register problem matcher
|
||||
|
||||
- name: Register problem matchers
|
||||
run: |
|
||||
echo "::add-matcher::.github/workflows/matchers/flake8.json"
|
||||
- run: flake8 aioesphomeapi
|
||||
black:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.7'
|
||||
- name: Set up Python environment
|
||||
run: |
|
||||
pip3 install -e .
|
||||
pip3 install -r requirements_test.txt
|
||||
- run: black --safe --exclude 'api_pb2.py|api_options_pb2.py' aioesphomeapi
|
||||
isort:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.7'
|
||||
- name: Set up Python environment
|
||||
run: |
|
||||
pip3 install -e .
|
||||
pip3 install -r requirements_test.txt
|
||||
- name: Register problem matcher
|
||||
run: |
|
||||
echo "::add-matcher::.github/workflows/matchers/pylint.json"
|
||||
echo "::add-matcher::.github/workflows/matchers/isort.json"
|
||||
- run: isort --check aioesphomeapi
|
||||
mypy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.7'
|
||||
- name: Set up Python environment
|
||||
run: |
|
||||
pip3 install -e .
|
||||
pip3 install -r requirements_test.txt
|
||||
- name: Register problem matcher
|
||||
run: |
|
||||
echo "::add-matcher::.github/workflows/matchers/mypy.json"
|
||||
- run: mypy --strict aioesphomeapi
|
||||
|
||||
- run: flake8 aioesphomeapi
|
||||
if: ${{ matrix.id == 'flake8' }}
|
||||
- run: pylint aioesphomeapi
|
||||
if: ${{ matrix.id == 'pylint' }}
|
||||
- run: black --check --diff --color aioesphomeapi
|
||||
if: ${{ matrix.id == 'black' }}
|
||||
- run: isort --check --diff aioesphomeapi
|
||||
if: ${{ matrix.id == 'isort' }}
|
||||
- run: mypy aioesphomeapi
|
||||
if: ${{ matrix.id == 'mypy' }}
|
||||
|
16
.github/workflows/release.yml
vendored
16
.github/workflows/release.yml
vendored
@ -5,25 +5,9 @@ on:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
pylint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.7'
|
||||
- name: Set up Python environment
|
||||
run: |
|
||||
pip3 install -e .
|
||||
pip3 install -r requirements_test.txt
|
||||
|
||||
- run: pylint aioesphomeapi
|
||||
|
||||
deploy-pypi:
|
||||
name: Build and publish to PyPi
|
||||
runs-on: ubuntu-latest
|
||||
needs: [pylint]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Python
|
||||
|
7
mypy.ini
Normal file
7
mypy.ini
Normal file
@ -0,0 +1,7 @@
|
||||
[mypy]
|
||||
python_version = 3.7
|
||||
show_error_codes = true
|
||||
|
||||
strict = true
|
||||
warn_unreachable = true
|
||||
|
18
pylintrc
18
pylintrc
@ -1,18 +0,0 @@
|
||||
[MASTER]
|
||||
reports=no
|
||||
ignore=api_pb2.py,api_options_pb2.py
|
||||
|
||||
disable=
|
||||
missing-docstring,
|
||||
too-few-public-methods,
|
||||
too-many-instance-attributes,
|
||||
wildcard-import,
|
||||
invalid-name,
|
||||
too-many-arguments,
|
||||
line-too-long,
|
||||
protected-access,
|
||||
unused-wildcard-import,
|
||||
import-outside-toplevel,
|
||||
raise-missing-from,
|
||||
bad-mcs-classmethod-argument,
|
||||
duplicate-code,
|
@ -2,3 +2,29 @@
|
||||
profile = "black"
|
||||
multi_line_output = 3
|
||||
extend_skip = ["api_pb2.py", "api_options_pb2.py"]
|
||||
|
||||
[tool.black]
|
||||
exclude = 'api_pb2.py|api_options_pb2.py'
|
||||
target-version = ['py37']
|
||||
|
||||
[tool.pylint.MASTER]
|
||||
reports = 'no'
|
||||
ignore = [
|
||||
"api_pb2.py",
|
||||
"api_options_pb2.py"
|
||||
]
|
||||
disable = [
|
||||
"missing-docstring",
|
||||
"too-few-public-methods",
|
||||
"too-many-instance-attributes",
|
||||
"wildcard-import",
|
||||
"invalid-name",
|
||||
"too-many-arguments",
|
||||
"line-too-long",
|
||||
"protected-access",
|
||||
"unused-wildcard-import",
|
||||
"import-outside-toplevel",
|
||||
"raise-missing-from",
|
||||
"bad-mcs-classmethod-argument",
|
||||
"duplicate-code",
|
||||
]
|
||||
|
@ -3,8 +3,8 @@
|
||||
cd "$(dirname "$0")/.."
|
||||
set -euxo pipefail
|
||||
|
||||
black --safe --exclude 'api_pb2.py|api_options_pb2.py' aioesphomeapi
|
||||
black --safe aioesphomeapi
|
||||
pylint aioesphomeapi
|
||||
flake8 aioesphomeapi
|
||||
isort aioesphomeapi
|
||||
mypy --strict aioesphomeapi
|
||||
mypy aioesphomeapi
|
||||
|
Loading…
Reference in New Issue
Block a user