Showing 12 of 22 total issues
File core.py
has 396 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
w1thermsensor
~~~~~~~~~~~~~
A Python package and CLI tool to work with w1 temperature sensors.
File cli.py
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
w1thermsensor
~~~~~~~~~~~~~
A Python package and CLI tool to work with w1 temperature sensors.
Function get
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def get(id_, hwid, type_, unit, resolution, as_json, offset):
"""Get temperature of a specific sensor"""
if id_ and (hwid or type_):
raise click.BadArgumentUsage(
"If --id is given --hwid and --type are not allowed."
- 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 ls
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def ls(types, as_json, resolution): # pylint: disable=invalid-name
"""List all available sensors"""
sensors = W1ThermSensor.get_available_sensors(types)
if as_json:
- 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 resolution
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def resolution(resolution, id_, hwid, type_):
"""Change the resolution for the sensor and persist it in the sensor's EEPROM"""
if id_ and (hwid or type_):
raise click.BadArgumentUsage(
"If --id is given --hwid and --type are not allowed."
- 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 evaluate_temperature
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def evaluate_temperature(
Function get
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def get(id_, hwid, type_, unit, resolution, as_json, offset):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function all
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def all(types, unit, resolution, as_json): # pylint: disable=redefined-builtin
"""Get temperatures of all available sensors"""
sensors = W1ThermSensor.get_available_sensors(types)
temperatures = []
for sensor in sensors:
- 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_available_sensors
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_available_sensors(
cls, types: Optional[Iterable[Union[Sensor, str]]] = None
) -> List["W1ThermSensor"]:
"""Return all available sensors.
- 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self,
sensor_type: Optional[Sensor] = None,
sensor_id: Optional[str] = None,
offset: float = 0.0,
- 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 __post_init__
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __post_init__(self):
"""
Validates that the required arguments are set and sanity check that the high points are
higher than the associated low points. This method does not sanity check that values make
sense for high/low point outside of high_point > low_point.
- 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"