Davidelanz/quantum-robot

View on GitHub

Showing 10 of 10 total issues

File model.py has 260 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from abc import ABC, abstractmethod
from typing import Dict

import matplotlib.pyplot as plt
import numpy as np
Severity: Minor
Found in src/qrobot/models/model.py - About 2 hrs to fix

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

    def _node_trace(
        graph: nx.Graph,
        positions: Dict[str, np.ndarray],
        size: int,
        font_size: int,
    Severity: Minor
    Found in src/qrobot/draw/draw.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 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(  # pylint: disable=too-many-arguments
    Severity: Major
    Found in src/qrobot/qunits/qunit.py - About 1 hr to fix

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

          def __init__(self, n, tau) -> None:  # pylint: disable=invalid-name
              """Initialize the class"""
      
              # Check the argument n
              if isinstance(n, int):
      Severity: Minor
      Found in src/qrobot/models/model.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 _edge_trace has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def _edge_trace(
      Severity: Minor
      Found in src/qrobot/draw/draw.py - About 45 mins to fix

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

        def qrobot_template(X, y, a=1, flag=True, f=None, **kwargs):
        Severity: Minor
        Found in docs/docstring_example/template.py - About 45 mins to fix

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

              def __init__(  # pylint: disable=too-many-arguments
          Severity: Minor
          Found in src/qrobot/qunits/sensorial.py - About 35 mins to fix

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

                def _target_vector_check(self, target_vector) -> list:
                    """This method ensures that a `target_vector` for the model
                    is an `n`-dimensional vector (where `n` is the model's dimension).
            
                    Raises
            Severity: Minor
            Found in src/qrobot/models/model.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 graph has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def graph(status_dict: dict) -> nx.DiGraph:
                """Given the Redis status dictionary, generate a `networkx` directed graph
                containing all the units connected as nodes.
            
                Args:
            Severity: Minor
            Found in src/qrobot/graph/graph.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 _write_edge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def _write_edge(graph: nx.Graph, node_id: str, key: str, value: Any):
                """Link units in the network by adding the respective edges."""
                if " in_qunits" in key:
                    in_qunits = json.loads(value)
                    for _, in_qunit in in_qunits.items():
            Severity: Minor
            Found in src/qrobot/graph/graph.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