Showing 216 of 245 total issues
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
Avoid deeply nested control flow statements. Open
if prob > best_intent_prob:
# finding the maximum confidence intent
if best_intent is not None:
# delete previous best intent
del bin_state[best_intent]
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function zero_state
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def zero_state(self, batch_size, dtype):
"""Modified from tensorflow's zero_state
see there for description of the parameters"""
# use AttentionWrapperState from superclass
- 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
if (graph.has_node(j) and
_nodes_are_equivalent(graph, i, j, max_history)):
# make sure we keep special styles
_transfer_style(graph.nodes(data=True)[j],
graph.nodes(data=True)[i])
Function create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create(obj, endpoint=None):
if isinstance(obj, NaturalLanguageInterpreter):
return obj
if not isinstance(obj, str):
- 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 _remove_auxiliary_nodes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _remove_auxiliary_nodes(graph: 'networkx.MultiDiGraph',
special_node_idx: int) -> None:
"""Remove any temporary or unused nodes."""
graph.remove_node(TMP_NODE_ID)
- 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 _add_edge
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _add_edge(graph, u, v, key, label=None, **kwargs):
Function add_to_store
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_to_store(
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 _split_conversation_at_restarts
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _split_conversation_at_restarts(
evts: List[Dict[Text, Any]]
) -> List[List[Dict[Text, Any]]]:
"""Split a conversation at restart 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 add_to_store
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def add_to_store(
self,
action_predictions: Optional[List[str]] = None,
action_targets: Optional[List[str]] = None,
intent_predictions: Optional[List[str]] = 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 run
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def run(model: Text, endpoints: Text, connector: Text = None,
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, url, team, user, pw, bot_channel):
Function test_cv_not_none_param_grid_none_triggers_search_without_params
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def test_cv_not_none_param_grid_none_triggers_search_without_params(
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function test_cv_not_none_param_grid_none_triggers_search_with_params
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def test_cv_not_none_param_grid_none_triggers_search_with_params(
Function test_stack_training
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def test_stack_training(app,