OpenJij/OpenJij

View on GitHub

Showing 458 of 458 total issues

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

    def _sample_hubo_old(
Severity: Major
Found in openjij/sampler/sa_sampler.py - About 1 hr to fix

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

    def se_success_probability(
        response, solutions, ref_energy=0, measure_with_energy=False
    ):
        """Calculate success probability's standard error from openjij.response
    
    
    Severity: Minor
    Found in openjij/utils/benchmark.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 success_probability has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def success_probability(response, solutions, ref_energy=0, measure_with_energy=False):
        """Calculate success probability from openjij.response
    
        Args:
            response (openjij.Response): response from solver (or sampler).
    Severity: Minor
    Found in openjij/utils/benchmark.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 _cxxjij_sampling has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def _cxxjij_sampling(
            self,
            model,
            init_generator,
            algorithm,
    Severity: Minor
    Found in openjij/sampler/sampler.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 _convert_validation_schedule has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def _convert_validation_schedule(self, schedule, beta):
            if not isinstance(schedule, (list, np.array)):
                raise ValueError("schedule should be list or numpy.array")
    
            if isinstance(schedule[0], cxxjij.utility.TransverseFieldSchedule):
    Severity: Minor
    Found in openjij/sampler/sqa_sampler.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 solver_benchmark has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def solver_benchmark(
    Severity: Major
    Found in openjij/utils/benchmark.py - About 1 hr to fix

      Function sample has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def sample(self, bqm, **parameters):
              """Sample from a binary quadratic model.
      
              Args:
                  bqm (openjij.BinaryQuadraticModel):
      Severity: Minor
      Found in openjij/sampler/sampler.py - About 55 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 base_sample_hubo has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def base_sample_hubo(
          hubo: dict[tuple, float],
          vartype: Optional[str] = None,
          num_sweeps: int = 1000,
          num_reads: int = 1,
      Severity: Minor
      Found in openjij/sampler/base_sa_sample_hubo.py - About 55 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 _cxxjij_sampling has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def _cxxjij_sampling(
      Severity: Major
      Found in openjij/sampler/sampler.py - About 50 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if v != 0 and v != 1:
                                    raise RuntimeError("The initial variables must be 0 or 1.")
                                temp_initial_state.append(2 * v - 1)
        Severity: Major
        Found in openjij/sampler/sa_sampler.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if v != -1 and v != 1:
                                      raise RuntimeError(
                                          "The initial variables must be -1 or +1."
                                      )
                                  temp_initial_state.append(v)
          Severity: Major
          Found in openjij/sampler/sa_sampler.py - About 45 mins to fix

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

            def KingGraph(
            Severity: Minor
            Found in openjij/model/king_graph.py - About 45 mins to fix

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

              def _make_BinaryPolynomialModel_from_hising_from_list(keys: list, values: list):
                  if len(keys) == 0:
                      return make_BinaryPolynomialModel({}).from_hising(keys, values)
              
                  i = 0
              Severity: Minor
              Found in openjij/model/model.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 _make_BinaryPolynomialModel_from_hubo_from_list has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def _make_BinaryPolynomialModel_from_hubo_from_list(keys: list, values: list):
                  if len(keys) == 0:
                      return make_BinaryPolynomialModel({}).from_hubo(keys, values)
              
                  i = 0
              Severity: Minor
              Found in openjij/model/model.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__(
              Severity: Minor
              Found in openjij/model/chimera_model.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if v != 0 and v != 1:
                                            raise RuntimeError("The initial variables must be 0 or 1.")
                                        temp_initial_state.append(2 * v - 1)
                Severity: Major
                Found in openjij/sampler/sa_sampler.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if v != -1 and v != 1:
                                              raise RuntimeError(
                                                  "The initial variables must be -1 or +1."
                                              )
                                          temp_initial_state.append(v)
                  Severity: Major
                  Found in openjij/sampler/sa_sampler.py - About 45 mins to fix

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

                    def ChimeraModel(
                    Severity: Minor
                    Found in openjij/model/chimera_model.py - About 45 mins to fix

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

                              def __init__(
                      Severity: Minor
                      Found in openjij/model/king_graph.py - About 45 mins to fix

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

                        def _BinaryPolynomialModel_from_list(keys: list, values: list, vartype):
                            if len(keys) == 0:
                                Model = make_BinaryPolynomialModel({})
                                return Model(keys, values, _to_cxxcimod(vartype))
                            i = 0
                        Severity: Minor
                        Found in openjij/model/model.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