Showing 7 of 25 total issues
Function send
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def send(self):
from yeelight import Flow
from yeelight import transitions
bulb = self.get_bulb()
state = self.state
- 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_body
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def update_body(self, body):
if (self.content_type or body) and self.component.method not in CONTENT_TYPE_METHODS:
raise ValidationError(
'Error on {}: The body/content-type option only can be used with the {} methods.'.format(
self.component.name, ', '.join(CONTENT_TYPE_METHODS)
- 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_template
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_template(self) -> TemplateBase:
if self._use in self._templates:
# TODO: use component_name for get the best template using params
return self._templates[self._use][-1]
template_name, component_name = self._get_use_name(default_template=False)
- 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.default_template_class()
Function get_next
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_next(self, on_end=None):
if self._files is None:
self._files = self.get_files()
on_end = on_end or self.component._on_end
try:
- 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 message
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def message(self, params=None, **kwargs):
if params is None:
params = Params()
if isinstance(params, TemplateBase):
params = params.args(**kwargs)
- 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_component
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_component(self, use=None):
use = use or self._use
if not self.components:
raise InvalidUsage('There are no configurations. Registers configs using '
'Then(<component config>)')
- 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"