File domain.py
has 1604 lines of code (exceeds 250 allowed). Consider refactoring. Open
import copy
import collections
import json
import logging
import os
Function merge_domain_dicts
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Wontfix
def merge_domain_dicts(
domain_dict: Dict,
combined: Dict,
override: bool = False,
) -> Dict:
- 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 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Avoid deeply nested control flow statements. Open
if (
ENTITY_FEATURIZATION_KEY in sub_labels
and sub_labels[ENTITY_FEATURIZATION_KEY] is False
):
entity_properties.default_ignored_entities.append(_entity)
Avoid deeply nested control flow statements. Open
if ENTITY_ROLES_KEY in sub_labels:
entity_properties.roles[_entity] = sub_labels[
ENTITY_ROLES_KEY
]
if ENTITY_GROUPS_KEY in sub_labels:
Avoid deeply nested control flow statements. Open
if ENTITY_GROUPS_KEY in sub_labels:
entity_properties.groups[_entity] = sub_labels[
ENTITY_GROUPS_KEY
]
if (
Function domain_warnings
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def domain_warnings(
Function states_for_tracker_history
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def states_for_tracker_history(
Function _reset_intent_flags
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _reset_intent_flags(intent: Dict[Text, Any]) -> None:
for intent_property in intent.values():
if (
USE_ENTITIES_KEY in intent_property.keys()
and not intent_property[USE_ENTITIES_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 from_directory
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def from_directory(cls, path: Text) -> "Domain":
"""Loads and merges multiple domain files recursively from a directory tree."""
combined: Dict[Text, Any] = {}
for root, _, files in os.walk(path, followlinks=True):
for file in files:
- 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"