Showing 17 of 17 total issues
File ojmicroline.py
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Asynchronous Python client communicating with the OJ Microline API."""
from __future__ import annotations
import asyncio
Function get_target_temperature
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_target_temperature(self) -> int:
"""Return the target temperature for the thermostat.
Returns
-------
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function from_json
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def from_json(cls, data: dict[str, Any]) -> Schedule:
"""Return a new Schedule instance based on the given JSON.
Args:
----
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function get_lowest_temperature
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_lowest_temperature(self) -> int:
"""Get the lowest temperature.
Returns the lowest temperature based on the
schedule. It is used for eco mode.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function update_regulation_mode_body
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update_regulation_mode_body( # noqa: D102
self,
thermostat: Thermostat,
regulation_mode: int,
temperature: int | None,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function update_regulation_mode_body
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def update_regulation_mode_body( # noqa: D102
Function update_regulation_mode_body
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def update_regulation_mode_body( # noqa: D102
Function parse_thermostats_response
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse_thermostats_response(self, data: Any) -> list[Thermostat]: # noqa: D102
if data["ErrorCode"] == 1:
msg = "Unable to get thermostats via API."
raise OJMicrolineResultsError(msg, {"data": data})
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_current_temperature
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_current_temperature(self) -> int:
"""Return the current temperature for the thermostat.
For WD5-series thermostats, the current temperature based on the
sensor type. If it is set to room/floor, then the average is used.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this function. Open
return self.frost_protection_temperature or 0
Avoid too many return
statements within this function. Open
return self.boost_temperature or 0
Avoid too many return
statements within this function. Open
return Schedule.from_json(self.schedule).get_lowest_temperature()
Avoid too many return
statements within this function. Open
return self.vacation_temperature or 0
Avoid too many return
statements within this function. Open
return 0
Avoid too many return
statements within this function. Open
return 0
Function parse_thermostats_response
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_thermostats_response(self, data: Any) -> list[Thermostat]: # noqa: D102
results: list[Thermostat] = []
for group in data["Groups"]:
for item in group["Thermostats"]:
if len(item):
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"