Skip to content

Commit 63f9f7f

Browse files
CFennerwoehrl01
andauthored
build: add pylint workflow (#349)
Co-authored-by: Lukas Wöhrl <lukas@woehrl.net>
1 parent f69604d commit 63f9f7f

10 files changed

Lines changed: 66 additions & 14 deletions

.github/workflows/build.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,25 @@ on:
99
- master
1010

1111
jobs:
12+
pylint:
13+
runs-on: ubuntu-20.04
14+
strategy:
15+
matrix:
16+
python-version: ["3.9"]
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install pylint
27+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
28+
- name: Analysing the code with pylint
29+
run: pylint $(git ls-files '*.py')
30+
1231
build:
1332
runs-on: ubuntu-20.04
1433
strategy:

.pylintrc

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[MAIN]
2+
3+
[MESSAGES CONTROL]
4+
disable=
5+
duplicate-code,
6+
fixme,
7+
format,
8+
invalid-name,
9+
too-many-public-methods,
10+
too-few-public-methods,
11+
# fix later
12+
arguments-differ,
13+
attribute-defined-outside-init,
14+
bad-classmethod-argument,
15+
chained-comparison,
16+
consider-merging-isinstance,
17+
consider-using-dict-items,
18+
consider-using-generator,
19+
consider-using-in,
20+
deprecated-decorator,
21+
f-string-without-interpolation,
22+
logging-fstring-interpolation,
23+
logging-not-lazy,
24+
missing-class-docstring,
25+
missing-function-docstring,
26+
missing-module-docstring,
27+
missing-timeout,
28+
no-else-raise,
29+
no-else-return,
30+
pointless-string-statement,
31+
raise-missing-from,
32+
super-init-not-called,
33+
too-many-boolean-expressions,
34+
unspecified-encoding,
35+
useless-object-inheritance,
36+
useless-parent-delegation,

PyViCare/PyViCareDeviceConfig.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ def asAutoDetectDevice(self):
9494

9595
for (creator_method, type_name, roles) in device_types:
9696
if re.search(type_name, self.device_model) or self.service.hasRoles(roles):
97-
logger.info("detected %s %s" %
98-
(self.device_model, creator_method.__name__))
97+
logger.info(f"detected {self.device_model} {creator_method.__name__}")
9998
return creator_method()
10099

101100
logger.info(

PyViCare/PyViCareElectricalEnergySystem.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from typing import Any, List
21
from PyViCare.PyViCareDevice import Device
32
from PyViCare.PyViCareUtils import handleNotSupported
43
from PyViCare.PyViCareService import ViCareService

PyViCare/PyViCareHeatingDevice.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
VICARE_DHW_TEMP2 = "temp-2"
1414

1515

16-
def all_set(list: List[Any]) -> bool:
17-
return all(v is not None for v in list)
16+
def all_set(_list: List[Any]) -> bool:
17+
return all(v is not None for v in _list)
1818

1919

2020
def get_available_burners(service):
@@ -605,9 +605,9 @@ def getActiveProgram(self):
605605
@handleNotSupported
606606
def getPrograms(self):
607607
available_programs = []
608-
for program in ['comfort', 'comfortCooling', 'comfortCoolingEnergySaving', 'comfortEnergySaving',
609-
'comfortHeating', 'dhwPrecedence', 'eco', 'external', 'fixed', 'forcedLastFromSchedule',
610-
'frostprotection', 'holiday', 'holidayAtHome', 'manual', 'normal', 'normalCooling',
608+
for program in ['comfort', 'comfortCooling', 'comfortCoolingEnergySaving', 'comfortEnergySaving',
609+
'comfortHeating', 'dhwPrecedence', 'eco', 'external', 'fixed', 'forcedLastFromSchedule',
610+
'frostprotection', 'holiday', 'holidayAtHome', 'manual', 'normal', 'normalCooling',
611611
'normalCoolingEnergySaving', 'normalEnergySaving', 'normalHeating', 'reduced', 'reducedCooling',
612612
'reducedCoolingEnergySaving', 'reducedEnergySaving', 'reducedHeating', 'standby', 'summerEco']:
613613
with suppress(PyViCareNotSupportedFeatureError):

PyViCare/PyViCareOAuthManager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def __serialize_token(self, oauth, token_file):
9696
with open(token_file, mode='wb') as binary_file:
9797
pickle.dump(oauth, binary_file)
9898

99-
logger.info("Token serialized to %s" % token_file)
99+
logger.info(f"Token serialized to {token_file}")
100100

101101
def __deserialize_token(self, token_file):
102102
if token_file is None or not os.path.isfile(token_file):

PyViCare/PyViCareService.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def buildSetPropertyUrl(accessor, property_name, action):
2828

2929

3030
class ViCareDeviceAccessor:
31-
def __init__(self, id: int, serial: str, device_id: str) -> None:
32-
self.id = id
31+
def __init__(self, _id: int, serial: str, device_id: str) -> None:
32+
self.id = _id
3333
self.serial = serial
3434
self.device_id = device_id
3535

PyViCare/PyViCareVentilationDevice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def getActiveProgram(self):
6060
json representation of the answer
6161
"""
6262
def activateProgram(self, program):
63-
return self.service.setProperty("ventilation.operating.programs.{program}", "activate", {})
63+
return self.service.setProperty(f"ventilation.operating.programs.{program}", "activate", {})
6464

6565
""" Deactivate a program
6666
Parameters

tests/test_VitoairFs300E.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import unittest
22

3-
from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError
43
from PyViCare.PyViCareVentilationDevice import VentilationDevice
54
from tests.ViCareServiceMock import ViCareServiceMock
65

tests/test_Vitocal200.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def test_getActiveProgramMinTemperature(self):
102102
def test_getActiveProgramMaxTemperature(self):
103103
self.assertEqual(self.device.getCircuit(0).getActiveProgramMaxTemperature(), 30)
104104

105-
def test_getActiveProgramMaxTemperature(self):
105+
def test_getActiveProgramStepping(self):
106106
self.assertEqual(self.device.getCircuit(0).getActiveProgramStepping(), 1)
107107

108108
def test_getNormalProgramMinTemperature(self):

0 commit comments

Comments
 (0)