Showing 543 of 559 total issues
File validator.py
has 354 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
from collections import defaultdict
from typing import Set, Text, Optional, Dict, Any, List
import rasa.core.training.story_conflict
File convert_featurizer.py
has 349 lines of code (exceeds 250 allowed). Consider refactoring. Open
from __future__ import annotations
import logging
import os
from typing import Any, Dict, List, Optional, Text, Tuple, Type
File facebook.py
has 348 lines of code (exceeds 250 allowed). Consider refactoring. Open
import copy
import hashlib
import hmac
import logging
import structlog
File yaml_story_writer.py
has 347 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections import OrderedDict
from pathlib import Path
from typing import Any, Dict, List, Text, Union, Optional
from ruamel import yaml
File bilou_utils.py
has 346 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
import operator
from collections import defaultdict, Counter
from typing import List, Tuple, Text, Optional, Dict, Any, TYPE_CHECKING
TrainingData
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
class TrainingData:
"""Holds loaded intent and entity training data."""
# Validation will ensure and warn if these lower limits are not met
MIN_EXAMPLES_PER_INTENT = 2
Function _process_step
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def _process_step(
self, step: StoryStep, incoming_trackers: List[TrackerWithCachedStates]
) -> TrackersTuple:
"""Processes a steps events with all trackers.
- 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 precomputation.py
has 333 lines of code (exceeds 250 allowed). Consider refactoring. Open
from __future__ import annotations
from typing import Optional, Text, Dict, List, Union, Iterable, Any
from collections.abc import ValuesView, KeysView
from rasa.engine.graph import GraphComponent
Function prepare_batch
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def prepare_batch(
data: Data,
start: Optional[int] = None,
end: Optional[int] = None,
tuple_sizes: Optional[Dict[Text, int]] = 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 _merge_equivalent_nodes
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def _merge_equivalent_nodes(graph: "networkx.MultiDiGraph", max_history: int) -> None:
"""Searches for equivalent nodes in the graph and merges them."""
changed = True
# every node merge changes the graph and can trigger previously
# impossible node merges - we need to repeat until
- 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 migrate.py
has 328 lines of code (exceeds 250 allowed). Consider refactoring. Open
import copy
import shutil
from pathlib import Path
from typing import List, Dict, Text, Any, Tuple, Optional, Union
File channel.py
has 325 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
import logging
import uuid
import jwt
from sanic import Sanic, Blueprint
DialogueStateTracker
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
class DialogueStateTracker:
"""Maintains the state of a conversation.
The field max_event_history will only give you these last events,
it can be set in the tracker_store.
Function as_story_string
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def as_story_string(self, flat: bool = False, e2e: bool = False) -> Text:
"""Returns a story as a string."""
# if the result should be flattened, we
# will exclude the caption and any checkpoints.
if flat:
- 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 twilio_voice.py
has 315 lines of code (exceeds 250 allowed). Consider refactoring. Open
from sanic import Blueprint, response
from sanic.request import Request
from sanic.response import HTTPResponse
from twilio.twiml.voice_response import VoiceResponse, Gather
from typing import Text, Callable, Awaitable, List, Any, Dict, Optional
File features.py
has 313 lines of code (exceeds 250 allowed). Consider refactoring. Open
from __future__ import annotations
from typing import Iterable, Union, Text, Optional, List, Any, Tuple, Dict, Set
import itertools
import numpy as np
File single_state_featurizer.py
has 312 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
import numpy as np
import scipy.sparse
from typing import List, Optional, Dict, Text, Set, Any
File data_generator.py
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
import math
from typing import List, Union, Text, Optional, Any, Tuple, Dict, cast
import logging
import scipy.sparse
Function _extract_features
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def _extract_features(
features: List[List[List["Features"]]],
fake_features: List["Features"],
attribute: Text,
) -> Tuple[
- 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 blueprint
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def blueprint(
self, on_new_message: Callable[[UserMessage], Awaitable[Any]]
) -> Blueprint:
telegram_webhook = Blueprint("telegram_webhook", __name__)
out_channel = self.get_output_channel()
- 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"