Function as_story_string
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
def as_story_string(self, flat=False, e2e=False):
# if the result should be flattened, we
# will exclude the caption and any checkpoints.
for s in self.start_checkpoints:
- 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
File structures.py
has 524 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections import deque, defaultdict
import io
import sys
import json
Function with_cycles_removed
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
def with_cycles_removed(self) -> 'StoryGraph':
"""Create a graph with the cyclic edges removed from this graph."""
story_end_checkpoints = self.story_end_checkpoints.copy()
cyclic_edge_ids = self.cyclic_edge_ids
- 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 visualize
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def visualize(self, output_file=None):
import networkx as nx
from rasa.core.training import visualization
from colorhash import ColorHash
- 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 topological_sort
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def topological_sort(
graph: Dict[Text, Set[Text]]
) -> Tuple[deque, Set[Tuple[Text, Text]]]:
"""Creates a top sort of a directed graph. This is an unstable sorting!
- 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 deeply nested control flow statements. Open
for cp in step.start_checkpoints:
if cp.name == original_cp:
if k == e:
cp_name = source_cp_name
else:
Avoid deeply nested control flow statements. Open
if (self.story_string_helper.form_validation and
s.action_name ==
self.story_string_helper.active_form):
result += self._bot_string(
ActionExecuted(ACTION_LISTEN_NAME))
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function _remove_unused_generated_cps
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _remove_unused_generated_cps(
self,
story_steps: Dict[Text, StoryStep],
overlapping_cps: Set[Text],
story_end_checkpoints: Dict[Text, Text]
- 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 explicit_events
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def explicit_events(self,
domain: Domain,
should_append_final_listen: bool = True) -> List[Event]:
"""Returns events contained in the story step
including implicit events.
- 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 as_story_string
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def as_story_string(self, flat=False, e2e=False):
story_content = ""
# initialize helper for first story step
story_string_helper = StoryStringHelper()
- 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"