Skip to content

Commit ab29c0a

Browse files
authored
Merge pull request #255 from plugwise/pre-commit
Install pre-commit.ci
2 parents 7a7564c + 1cf98dc commit ab29c0a

File tree

8 files changed

+58
-65
lines changed

8 files changed

+58
-65
lines changed

.flake8

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
[flake8]
2-
ignore = E203, E231, E266, E501, W503, F403, F401, W503
2+
exclude =
3+
.venv,
4+
.git,
5+
.tox,
6+
docs,
7+
venv,
8+
bin,
9+
lib,
10+
deps,
11+
build,
12+
plugwise/connections/*.py,
13+
plugwise/messages/*.py,
14+
plugwise/nodes/*.py,
15+
plugwise/controller.py,
16+
plugwise/parser.py,
17+
plugwise/stick.py,
18+
plugwise/util.py
19+
ignore = E203,E231,E266,E501,W503,F403,F401,W503
320
max-line-length = 89
421
max-complexity = 20
5-
select = B,C,E,F,W,T4,B9

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ body:
131131
132132
- type: textarea
133133
attributes:
134-
label: Generic or other logging (provide tools and version used)
135134
label: Diagnostics information
136135
description: >-
137136
Provide your version of python used and/or include any and all informational, error and debug messages.

.github/workflows/codeql-analysis.yml

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313
name: "CodeQL"
1414

1515
on:
16-
# push:
17-
# branches: [ main ]
18-
# pull_request:
19-
# # The branches below must be a subset of the branches above
20-
# branches: [ main ]
16+
# push:
17+
# branches: [ main ]
18+
# pull_request:
19+
# # The branches below must be a subset of the branches above
20+
# branches: [ main ]
2121
schedule:
22-
- cron: '24 14 * * 5'
22+
- cron: "24 14 * * 5"
2323

2424
jobs:
2525
analyze:
@@ -29,41 +29,40 @@ jobs:
2929
strategy:
3030
fail-fast: false
3131
matrix:
32-
language: [ 'python' ]
32+
language: ["python"]
3333
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
3434
# Learn more...
3535
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
3636

3737
steps:
38-
- name: Checkout repository
39-
uses: actions/checkout@v3
38+
- name: Checkout repository
39+
uses: actions/checkout@v3
4040

41-
# Initializes the CodeQL tools for scanning.
42-
- name: Initialize CodeQL
43-
uses: github/codeql-action/init@v2
44-
with:
45-
languages: ${{ matrix.language }}
46-
# If you wish to specify custom queries, you can do so here or in a config file.
47-
# By default, queries listed here will override any specified in a config file.
48-
# Prefix the list here with "+" to use these queries and those in the config file.
49-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
41+
# Initializes the CodeQL tools for scanning.
42+
- name: Initialize CodeQL
43+
uses: github/codeql-action/init@v2
44+
with:
45+
languages: ${{ matrix.language }}
46+
# If you wish to specify custom queries, you can do so here or in a config file.
47+
# By default, queries listed here will override any specified in a config file.
48+
# Prefix the list here with "+" to use these queries and those in the config file.
49+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
5050

51-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
52-
# If this step fails, then you should remove it and run the build manually (see below)
53-
- name: Autobuild
54-
uses: github/codeql-action/autobuild@v2
51+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
52+
# If this step fails, then you should remove it and run the build manually (see below)
53+
- name: Autobuild
54+
uses: github/codeql-action/autobuild@v2
5555

56-
# ℹ️ Command-line programs to run using the OS shell.
57-
# 📚 https://git.io/JvXDl
56+
# ℹ️ Command-line programs to run using the OS shell.
57+
# 📚 https://git.io/JvXDl
5858

59-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
60-
# and modify them (or add more) to build your code if your project
61-
# uses a compiled language
59+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
60+
# and modify them (or add more) to build your code if your project
61+
# uses a compiled language
6262

63-
#- run: |
64-
# make bootstrap
65-
# make release
66-
67-
- name: Perform CodeQL Analysis
68-
uses: github/codeql-action/analyze@v2
63+
#- run: |
64+
# make bootstrap
65+
# make release
6966

67+
- name: Perform CodeQL Analysis
68+
uses: github/codeql-action/analyze@v2

.github/workflows/verify.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,7 @@ jobs:
152152
- name: Verify commit
153153
run: |
154154
. venv/bin/activate
155-
pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual bandit
156-
pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual black
157-
pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual codespell
158-
pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual flake8
159-
#pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual isort
160-
pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual mypy
161-
pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual userdata
162-
pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual yamllint
155+
pre-commit run --show-diff-on-failure --color=always --all-files --hook-stage manual pylint
163156
164157
prepare-test-cache:
165158
runs-on: ubuntu-latest

.pre-commit-config.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
ci:
2+
skip: [pylint]
3+
submodules: true
4+
15
default_language_version:
26
# force all unspecified python hooks to run python3
3-
python: python3.9
7+
python: python3.10
8+
49
repos:
510
# Run manually in CI skipping the branch checks
611
- repo: https://github.com/PyCQA/isort

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Our main usage for this module is supporting [Home Assistant](https://www.home-a
1010
[![codecov](https://codecov.io/gh/plugwise/python-plugwise/branch/main/graph/badge.svg)](https://codecov.io/gh/plugwise/python-plugwise)
1111
[![PyPI version fury.io](https://badge.fury.io/py/plugwise.svg)](https://pypi.python.org/pypi/plugwise/)
1212
[![Newest commit](https://github.com/plugwise/python-plugwise/workflows/Latest%20commit/badge.svg)](https://github.com/plugwise/python-plugwise/actions)
13+
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/plugwise/python-plugwise/main.svg)](https://results.pre-commit.ci/latest/github/plugwise/python-plugwise/main)
1314

1415
## Integration
1516

setup.cfg

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,6 @@ classifier =
1313
Programming Language :: Python :: 3.9
1414
Topic :: Home Automation
1515

16-
[flake8]
17-
exclude = .venv,.git,.tox,docs,venv,bin,lib,deps,build
18-
doctests = True
19-
# To work with Black
20-
# E501: line too long
21-
# W503: Line break occurred before a binary operator
22-
# E203: Whitespace before ':'
23-
# D202 No blank lines allowed after function docstring
24-
# W504 line break after binary operator
25-
ignore =
26-
E501,
27-
W503,
28-
E203,
29-
D202,
30-
W504
31-
3216
[mypy]
3317
python_version = 3.9
3418
show_error_codes = true

tests/test_smile.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ async def connect_wrapper(
308308
self, raise_timeout=False, fail_auth=False, stretch=False
309309
):
310310
"""Wrap connect to try negative testing before positive testing."""
311-
312311
if fail_auth:
313312
try:
314313
_LOGGER.warning("Connecting to device with invalid credentials:")
@@ -5220,7 +5219,6 @@ async def test_fail_anna_connected_to_adam(self):
52205219
@pytest.mark.asyncio
52215220
async def test_invalid_credentials(self):
52225221
"""Test P1 with invalid credentials setup."""
5223-
52245222
self.smile_setup = "p1v4"
52255223
try:
52265224
await self.connect_wrapper(fail_auth=True)
@@ -5232,7 +5230,6 @@ async def test_invalid_credentials(self):
52325230
@pytest.mark.asyncio
52335231
async def test_connect_fail_firmware(self):
52345232
"""Test a P1 non existing firmware setup."""
5235-
52365233
self.smile_setup = "fail_firmware"
52375234
try:
52385235
await self.connect_wrapper()
@@ -5245,7 +5242,6 @@ async def test_connect_fail_firmware(self):
52455242
@pytest.mark.asyncio
52465243
async def test_connect_timeout(self, timeout_test):
52475244
"""Wrap connect to raise timeout during get."""
5248-
52495245
# pylint: disable=unused-variable
52505246
try:
52515247
self.smile_setup = "p1v4"

0 commit comments

Comments
 (0)