Skip to content

Commit

Permalink
build: enable pylint E and F rule classes (#222)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Chores**
  - Added `pylint` to pre-commit checks configuration.
- Enhanced Pylint configurations for improved code quality and
consistency.
  - Added `pylint` and `setuptools` to development dependencies.
  - Suppressed specific Pylint warning in `device.py`.
  - Removed `"macos-latest"` from Python version testing in CI workflow.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
chemelli74 authored Jul 16, 2024
1 parent 815643a commit a650a6a
Show file tree
Hide file tree
Showing 5 changed files with 418 additions and 7 deletions.
13 changes: 12 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ci:
autofix_commit_msg: "chore(pre-commit.ci): auto fixes"
autoupdate_commit_msg: "chore(pre-commit.ci): pre-commit autoupdate"
autoupdate_schedule: weekly
skip: [mypy]
skip: [mypy, pylint]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down Expand Up @@ -56,3 +56,14 @@ repos:
entry: mypy
language: system
types: [python]
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
args: [
"-rn", # Only display messages
"-sn", # Don't display the score
"--rcfile=pylintrc",
"--ignore-paths=tests",
]
4 changes: 2 additions & 2 deletions midealocal/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def connect(
file = None
lineno = None
if e.__traceback__:
file = e.__traceback__.tb_frame.f_globals["__file__"]
file = e.__traceback__.tb_frame.f_globals["__file__"] # pylint: disable=E1101
lineno = e.__traceback__.tb_lineno
_LOGGER.exception(
"[%s] Unknown error : %s, %s",
Expand Down Expand Up @@ -555,7 +555,7 @@ def run(self) -> None:
file = None
lineno = None
if e.__traceback__:
file = e.__traceback__.tb_frame.f_globals["__file__"]
file = e.__traceback__.tb_frame.f_globals["__file__"] # pylint: disable=E1101
lineno = e.__traceback__.tb_lineno
_LOGGER.exception(
"[%s] Unknown error : %s, %s",
Expand Down
8 changes: 4 additions & 4 deletions midealocal/devices/ac/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,8 @@ def _body(self) -> bytearray:
)
if self.fresh_air_1 is not None and len(self.fresh_air_1) == FRESH_AIR_LENGTH:
pack_count += 1
fresh_air_power = 2 if self.fresh_air_1[0] > 0 else 1
fresh_air_fan_speed = self.fresh_air_1[1]
fresh_air_power = 2 if next(iter(self.fresh_air_1)) > 0 else 1
fresh_air_fan_speed = list(self.fresh_air_1)[1]
payload.extend(
NewProtocolMessageBody.pack(
param=NewProtocolTags.fresh_air_1,
Expand All @@ -597,8 +597,8 @@ def _body(self) -> bytearray:
)
if self.fresh_air_2 is not None and len(self.fresh_air_2) == FRESH_AIR_LENGTH:
pack_count += 1
fresh_air_power = 1 if self.fresh_air_2[0] > 0 else 0
fresh_air_fan_speed = self.fresh_air_2[1]
fresh_air_power = 1 if next(iter(self.fresh_air_2)) > 0 else 0
fresh_air_fan_speed = list(self.fresh_air_2)[1]
payload.extend(
NewProtocolMessageBody.pack(
param=NewProtocolTags.fresh_air_2,
Expand Down
Loading

0 comments on commit a650a6a

Please sign in to comment.