Showing 543 of 559 total issues

File pika.py has 307 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import asyncio
import json
import logging
import structlog
import os
Severity: Minor
Found in rasa/core/brokers/pika.py - About 3 hrs to fix

    Function exports has 83 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function (context, options) {
      const { siteConfig } = context;
      const { themeConfig } = siteConfig;
      const { gtm } = themeConfig || {};
    
    
    Severity: Major
    Found in docs/plugins/google-tagmanager/index.js - About 3 hrs to fix

      File utils.py has 300 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import json
      import argparse
      import logging
      import os
      import sys
      Severity: Minor
      Found in rasa/cli/utils.py - About 3 hrs to fix

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

        def serve_application(
        Severity: Major
        Found in rasa/core/run.py - About 3 hrs to fix

          Function _create_features_for_token has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

              def _create_features_for_token(
                  self,
                  crf_tokens: List[CRFToken],
                  token_idx: int,
                  half_window_size: int,
          Severity: Minor
          Found in rasa/nlu/extractors/crf_entity_extractor.py - About 2 hrs 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

          File story_conflict.py has 288 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          from collections import defaultdict
          import logging
          import json
          from typing import DefaultDict, Dict, Generator, List, NamedTuple, Optional, Text, Tuple
          
          
          Severity: Minor
          Found in rasa/core/training/story_conflict.py - About 2 hrs to fix

            Function convert_predictions_into_entities has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                def convert_predictions_into_entities(
                    text: Text,
                    tokens: List[Token],
                    tags: Dict[Text, List[Text]],
                    split_entities_config: Optional[Dict[Text, bool]] = None,
            Severity: Minor
            Found in rasa/nlu/extractors/extractor.py - About 2 hrs 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

            File plotting.py has 281 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import logging
            import itertools
            import os
            from functools import wraps
            
            
            Severity: Minor
            Found in rasa/utils/plotting.py - About 2 hrs to fix

              File sidebars.js has 277 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module.exports = {
                default: [
                  "introduction",
                  "rasa-pro",
                  {
              Severity: Minor
              Found in docs/sidebars.js - About 2 hrs to fix

                File botframework.py has 277 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import datetime
                import json
                import logging
                import re
                from http import HTTPStatus
                Severity: Minor
                Found in rasa/core/channels/botframework.py - About 2 hrs to fix

                  Function raise_warning has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def raise_warning(
                      message: Text,
                      category: Optional[Type[Warning]] = None,
                      docs: Optional[Text] = None,
                      **kwargs: Any,
                  Severity: Minor
                  Found in rasa/shared/utils/io.py - About 2 hrs 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 _features_for_patterns has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _features_for_patterns(
                          self, message: Message, attribute: Text
                      ) -> Tuple[Optional[scipy.sparse.coo_matrix], Optional[scipy.sparse.coo_matrix]]:
                          """Checks which known patterns match the message.
                  
                  
                  Severity: Minor
                  Found in rasa/nlu/featurizers/sparse_featurizer/regex_featurizer.py - About 2 hrs 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

                  File kafka.py has 274 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import asyncio
                  import os
                  import json
                  import logging
                  import structlog
                  Severity: Minor
                  Found in rasa/core/brokers/kafka.py - About 2 hrs to fix

                    File utils.py has 268 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import json
                    import logging
                    import os
                    from decimal import Decimal
                    from pathlib import Path
                    Severity: Minor
                    Found in rasa/core/utils.py - About 2 hrs to fix

                      Function injectHtmlTags has 60 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          injectHtmlTags() {
                            return {
                              headTags: [
                                {
                                  tagName: 'link',
                      Severity: Major
                      Found in docs/plugins/google-tagmanager/index.js - About 2 hrs to fix

                        File run.py has 266 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import asyncio
                        import logging
                        import uuid
                        import os
                        from functools import partial
                        Severity: Minor
                        Found in rasa/core/run.py - About 2 hrs to fix

                          File lock_store.py has 265 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          from __future__ import annotations
                          import asyncio
                          from contextlib import asynccontextmanager
                          import json
                          import logging
                          Severity: Minor
                          Found in rasa/core/lock_store.py - About 2 hrs to fix

                            File ensemble.py has 263 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            from __future__ import annotations
                            from abc import abstractmethod, ABC
                            from typing import Optional, Text, List, Dict, Any
                            import logging
                            
                            
                            Severity: Minor
                            Found in rasa/core/policies/ensemble.py - About 2 hrs to fix

                              Function configure_app has 18 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              def configure_app(
                              Severity: Major
                              Found in rasa/core/run.py - About 2 hrs to fix

                                Function blueprint has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def blueprint(
                                        self, on_new_message: Callable[[UserMessage], Awaitable[Any]]
                                    ) -> Blueprint:
                                        """Defines a Sanic blueprint."""
                                        # Workaround so that socketio works with requests from other origins.
                                Severity: Minor
                                Found in rasa/core/channels/socketio.py - About 2 hrs 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