RasaHQ/rasa_core

View on GitHub

Showing 243 of 245 total issues

Function _create_attn_cell has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def _create_attn_cell(self,
Severity: Major
Found in rasa/core/policies/embedding_policy.py - About 50 mins to fix

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

        def __init__(self, domain, host='localhost',
    Severity: Major
    Found in rasa/core/tracker_store.py - About 50 mins to fix

      Function _create_tf_dial_embed has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def _create_tf_dial_embed(
      Severity: Major
      Found in rasa/core/policies/embedding_policy.py - About 50 mins to fix

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

            def __init__(
        Severity: Major
        Found in rasa/core/agent.py - About 50 mins to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                              tf.TensorArray(dtype, size=self._sequence_len + 1,
                                             dynamic_size=False,
                                             clear_after_read=False
                                             ).write(0, zero_state.cell_state.h)
          Severity: Minor
          Found in rasa/core/policies/tf_utils.py and 1 other location - About 50 mins to fix
          rasa/core/policies/tf_utils.py on lines 458..461

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 36.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                              tf.TensorArray(dtype, size=self._sequence_len + 1,
                                             dynamic_size=False,
                                             clear_after_read=False
                                             ).write(0, zero_state.cell_state.c),
          Severity: Minor
          Found in rasa/core/policies/tf_utils.py and 1 other location - About 50 mins to fix
          rasa/core/policies/tf_utils.py on lines 462..465

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 36.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Avoid deeply nested control flow statements.
          Open

                                  with warnings.catch_warnings():
                                      warnings.simplefilter("ignore")
                                      model = load_model(model_file)
          
          
          Severity: Major
          Found in rasa/core/policies/keras_policy.py - About 45 mins to fix

            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]
            Severity: Major
            Found in rasa/core/featurizers.py - About 45 mins to fix

              Function collect_templates has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def collect_templates(
                      yml_templates: Dict[Text, List[Any]]
                  ) -> Dict[Text, List[Dict[Text, Any]]]:
                      """Go through the templates and make sure they are all in dict format
                      """
              Severity: Minor
              Found in rasa/core/domain.py - About 45 mins 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 as_story_string has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def as_story_string(self, e2e=False):
                      if self.intent:
                          if self.entities:
                              ent_string = json.dumps({ent['entity']: ent['value']
                                                       for ent in self.entities})
              Severity: Minor
              Found in rasa/core/events/__init__.py - About 45 mins 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

              Avoid deeply nested control flow statements.
              Open

                                      if s.type_name == 'list':
                                          slot_events.append(SlotSet(s.name,
                                                                     matching_entities))
                                      else:
                                          slot_events.append(SlotSet(s.name,
              Severity: Major
              Found in rasa/core/domain.py - About 45 mins to fix

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

                    def __init__(self, domain, url, port, db, password, record_exp):
                Severity: Minor
                Found in tests/core/test_tracker_stores.py - About 45 mins to fix

                  Function __init__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def __init__(self,
                                   text: Optional[Text],
                                   output_channel: Optional['OutputChannel'] = None,
                                   sender_id: Text = None,
                                   parse_data: Dict[Text, Any] = None,
                  Severity: Minor
                  Found in rasa/core/channels/channel.py - About 45 mins 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 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
                  Severity: Minor
                  Found in rasa/core/events/__init__.py - About 45 mins 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 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def __init__(self,
                  Severity: Minor
                  Found in rasa/core/channels/channel.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if online:
                                                logger.info("Original stories are "
                                                            "different for {} -- {}\n"
                                                            "Memorized the new ones for "
                                                            "now. Delete contradicting "
                    Severity: Major
                    Found in rasa/core/policies/memoization.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if self.remove_duplicates:
                                                  hashed = self._hash_example(sliced_states,
                                                                              event.action_name)
                      
                                                  # only continue with tracker_states that created a
                      Severity: Major
                      Found in rasa/core/featurizers.py - About 45 mins to fix

                        Function test has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def test(model: Text, stories: Text, nlu_data: Text, endpoints: Text = None,
                        Severity: Minor
                        Found in rasa/test.py - About 45 mins to fix

                          Function configure_app has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def configure_app(input_channels=None,
                                            cors=None,
                                            auth_token=None,
                                            enable_api=True,
                                            jwt_secret=None,
                          Severity: Minor
                          Found in rasa/core/run.py - About 45 mins 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 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
                          Severity: Minor
                          Found in rasa/core/policies/tf_utils.py - About 45 mins 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