File __init__.py
has 747 lines of code (exceeds 250 allowed). Consider refactoring. Open
import time
import typing
import json
import jsonpickle
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, text,
Function as_story_string
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def as_story_string(self, e2e=False):
if self.intent:
if self.entities:
ent_string = json.dumps({ent['entity']: ent['value']
for ent in self.entities})
- 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 first_key
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def first_key(d, default_key):
if len(d) > 1:
for k, v in d.items():
if k != default_key:
# we return the first key that is not the default key
- 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 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, action_name, trigger_date_time, name=None,
Function deserialise_events
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def deserialise_events(serialized_events: List[Dict[Text, Any]]
) -> List['Event']:
"""Convert a list of dictionaries to a list of corresponding events.
Example format:
- 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 resolve_by_type
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def resolve_by_type(
type_name: Text,
default: Optional[Type['Event']] = None
) -> Optional[Type['Event']]:
"""Returns a slots class by its type name."""
- 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"