ralphg6/david

View on GitHub

Showing 10 of 10 total issues

Function process has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def process(self, message: Message, **kwargs: Any) -> None:

        input = message.get(TEXT_ATTRIBUTE)

        tokens = tokenize(self.intent_model["stopwords"], input)
Severity: Minor
Found in dazu/components/nlu/simple.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 train has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def train(
        self, training_data: TrainingData, cfg: DazuConfig, **kwargs: Any
    ) -> None:

        self.intent_model = {"stopwords": training_data.data["nlu"]["stopwords"]}
Severity: Minor
Found in dazu/components/nlu/simple.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 load has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def load(
Severity: Minor
Found in dazu/components/nlu/simple.py - About 35 mins to fix

    Function load has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def load(
    Severity: Minor
    Found in dazu/components/component.py - About 35 mins to fix

      Function load has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def load(
      Severity: Minor
      Found in dazu/components/dialogue/simple.py - About 35 mins to fix

        Function build has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def build(
        Severity: Minor
        Found in dazu/typing/message.py - About 35 mins to fix

          Function __dialog has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def __dialog(self, input, context, intents, entities):
                  if input == "":
                      return get_dialog_welcome(self.dialog_nodes)
          
                  if len(intents) > 0:
          Severity: Minor
          Found in dazu/components/dialogue/simple.py - About 35 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 load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def load(config: Optional[Union[Text, Dict]] = None, **kwargs: Any) -> "DazuConfig":
              if isinstance(config, Dict):
                  return _load_from_dict(config, **kwargs)
          
              file_config = {}
          Severity: Minor
          Found in dazu/config.py - About 25 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(self, configuration_values: Optional[Dict[Text, Any]] = None) -> None:
                  """Create a model configuration, optionally overriding
                  defaults with a dictionary ``configuration_values``.
                  """
                  if not configuration_values:
          Severity: Minor
          Found in dazu/config.py - About 25 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 list_directory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def list_directory(path: Text) -> List[Text]:
              """Returns all files and folders excluding hidden files.
              If the path points to a file, returns the file. This is a recursive
              implementation returning files in any depth of the path.
              """
          Severity: Minor
          Found in dazu/utils/io.py - About 25 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