RasaHQ/rasa_core

View on GitHub

Showing 216 of 245 total issues

Function print_bot_output has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def print_bot_output(message, color=rasa.cli.utils.bcolors.OKBLUE):
    if "text" in message:
        rasa.cli.utils.print_color(message.get("text"),
                                   color)

Severity: Minor
Found in rasa/core/channels/console.py - About 1 hr to fix

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 predict_action_probabilities has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def predict_action_probabilities(self,
                                     tracker: DialogueStateTracker,
                                     domain: Domain) -> List[float]:
        """Predicts the corresponding form action if there is an active form"""
        result = [0.0] * domain.num_actions
Severity: Minor
Found in rasa/core/policies/form_policy.py - About 1 hr to fix

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 predict_action_probabilities has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def predict_action_probabilities(self,
                                     tracker: DialogueStateTracker,
                                     domain: Domain) -> List[float]:
        """Predicts the next action if NLU confidence is low.
        """
Severity: Minor
Found in rasa/core/policies/two_stage_fallback.py - About 1 hr to fix

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 11 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self,
Severity: Major
Found in rasa/core/policies/tf_utils.py - About 1 hr to fix

    Function serve_application has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def serve_application(core_model=None,
    Severity: Major
    Found in rasa/core/run.py - About 1 hr to fix

      Function _find_core_nlu_files_in_directory has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def _find_core_nlu_files_in_directory(directory: Text
                                            ) -> Tuple[Set[Text], Set[Text]]:
          story_files = set()
          nlu_data_files = set()
          for root, _, files in os.walk(directory):
      Severity: Minor
      Found in rasa/data.py - About 1 hr to fix

      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_dict has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def from_dict(cls, dictionary: Dict[Text, Any]) -> List[Policy]:
              policies = dictionary.get('policies') or dictionary.get('policy')
              if policies is None:
                  raise InvalidPolicyConfig("You didn't define any policies. "
                                            "Please define them under 'policies:' "
      Severity: Minor
      Found in rasa/core/policies/ensemble.py - About 1 hr to fix

      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 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, host,
      Severity: Major
      Found in rasa/core/broker.py - About 1 hr to fix

        Function collect_intent_properties has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def collect_intent_properties(intent_list):
                intent_properties = {}
                for intent in intent_list:
                    if isinstance(intent, dict):
                        for properties in intent.values():
        Severity: Minor
        Found in rasa/core/domain.py - About 1 hr to fix

        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 has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def merge(self, domain: 'Domain', override: bool = False) -> 'Domain':
                """Merge this domain with another one, combining their attributes.
        
                List attributes like ``intents`` and ``actions`` will be deduped
                and merged. Single attributes will be taken from ``self`` unless
        Severity: Minor
        Found in rasa/core/domain.py - About 1 hr to fix

        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 test_missing_classes_filled_correctly has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def test_missing_classes_filled_correctly(
                    self, default_domain, trackers, tracker, featurizer, priority):
                # Pretend that a couple of classes are missing and check that
                # those classes are predicted as 0, while the other class
                # probabilities are predicted normally.
        Severity: Minor
        Found in tests/core/test_policies.py - About 1 hr to fix

        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 message_for_data has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def message_for_data(self, structured_info):
                """Find a data sample with the same intent and entities.
        
                Given the parsed data from a message (intent and entities) finds a
                message in the data that has the same intent and entities."""
        Severity: Minor
        Found in rasa/core/training/visualization.py - About 1 hr to fix

        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 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def __init__(
                self,
                featurizer: Optional[FullDialogueTrackerFeaturizer] = None,
                priority: int = 1,
                encoded_all_actions: Optional[np.ndarray] = None,
        Severity: Minor
        Found in rasa/core/policies/embedding_policy.py - About 1 hr to fix

          Function __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(
          Severity: Major
          Found in rasa/core/policies/sklearn_policy.py - About 1 hr to fix

            Function _compute_time_attention has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def _compute_time_attention(attention_mechanism, attn_inputs, attention_state,
            Severity: Major
            Found in rasa/core/policies/tf_utils.py - About 1 hr to fix

              Function __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(self,
              Severity: Major
              Found in rasa/core/processor.py - About 1 hr to fix

                Function _back_to_the_future_again has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _back_to_the_future_again(tracker):
                        """Send Marty to the past to get
                            the new featurization for the future"""
                
                        idx_of_first_action = None
                Severity: Minor
                Found in rasa/core/policies/memoization.py - About 1 hr to fix

                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 test_ensemble_from_dict has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                def test_ensemble_from_dict():
                    def check_memoization(p):
                        assert p.max_history == 5
                        assert p.priority == 3
                
                
                Severity: Minor
                Found in tests/core/test_config.py - About 1 hr to fix

                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 probabilities_using_best_policy has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def probabilities_using_best_policy(self,
                                                        tracker: DialogueStateTracker,
                                                        domain: Domain
                                                        ) -> Tuple[List[float], Text]:
                        result = None
                Severity: Minor
                Found in rasa/core/policies/ensemble.py - About 1 hr to fix

                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 encode has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    def encode(self, state: Dict[Text, float]) -> np.ndarray:
                        """Returns a binary vector indicating which features are active.
                
                            Given a dictionary of states (e.g. 'intent_greet',
                            'prev_action_listen',...) return a binary vector indicating which
                Severity: Minor
                Found in rasa/core/featurizers.py - About 1 hr to fix

                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

                Severity
                Category
                Status
                Source
                Language