From 03c2cef628fe13165232f014760613920c10c246 Mon Sep 17 00:00:00 2001 From: "firstof9@gmail.com" Date: Fri, 6 Sep 2024 09:12:54 -0700 Subject: [PATCH] linting Signed-off-by: firstof9@gmail.com --- custom_components/gasbuddy/const.py | 2 +- custom_components/gasbuddy/entity.py | 3 +- pylintrc | 50 ++++++++++++++++++++++++++++ tests/test_sensor.py | 2 +- 4 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 pylintrc diff --git a/custom_components/gasbuddy/const.py b/custom_components/gasbuddy/const.py index 5b1eb14..23e0229 100644 --- a/custom_components/gasbuddy/const.py +++ b/custom_components/gasbuddy/const.py @@ -81,5 +81,5 @@ cash=True, icon="mdi:gas-station", suggested_display_precision=2, - ), + ), } diff --git a/custom_components/gasbuddy/entity.py b/custom_components/gasbuddy/entity.py index a747dbd..97c66a0 100644 --- a/custom_components/gasbuddy/entity.py +++ b/custom_components/gasbuddy/entity.py @@ -6,8 +6,9 @@ from homeassistant.components.sensor import SensorEntityDescription + @dataclass class GasBuddySensorEntityDescription(SensorEntityDescription): """Class describing OpenEVSE select entities.""" - cash: bool | None = None \ No newline at end of file + cash: bool | None = None diff --git a/pylintrc b/pylintrc new file mode 100644 index 0000000..b2b2967 --- /dev/null +++ b/pylintrc @@ -0,0 +1,50 @@ +[MASTER] +ignore=tests +# Use a conservative default here; 2 should speed up most setups and not hurt +# any too bad. Override on command line as appropriate. +jobs=2 +persistent=no + +[BASIC] +good-names=id,i,j,k,ex,Run,_,fp +max-attributes=15 +argument-naming-style=snake_case +attr-naming-style=snake_case + +[MESSAGES CONTROL] +# Reasons disabled: +# locally-disabled - it spams too much +# too-many-* - are not enforced for the sake of readability +# too-few-* - same as too-many-* +# import-outside-toplevel - TODO +disable= + duplicate-code, + fixme, + import-outside-toplevel, + locally-disabled, + too-few-public-methods, + too-many-arguments, + too-many-public-methods, + too-many-instance-attributes, + too-many-branches, + too-many-statements, + broad-except, + too-many-lines, + too-many-locals, + unexpected-keyword-arg, + abstract-method, + +[REFACTORING] + +# Maximum number of nested blocks for function / method body +max-nested-blocks=8 + +[REPORTS] +score=no + +[TYPECHECK] +# For attrs +ignored-classes=_CountingAttr + +[FORMAT] +expected-line-ending-format=LF \ No newline at end of file diff --git a/tests/test_sensor.py b/tests/test_sensor.py index f7db3af..70ae364 100644 --- a/tests/test_sensor.py +++ b/tests/test_sensor.py @@ -44,7 +44,7 @@ async def test_sensors(hass, mock_gasbuddy): assert state.state == "3.45" state = hass.states.get("sensor.gas_station_premium_gas_cash") assert state - assert state.state == "3.35" + assert state.state == "3.35" async def test_sensors_no_uom(hass, mock_gasbuddy):