jaredbeck/graph_matching

View on GitHub

Showing 76 of 76 total issues

Avoid deeply nested control flow statements.
Open

                    if not allowedge[k]:
                        kslack = slack(k)
                        if kslack <= 0:
                            # edge k has zero slack => it is allowable
                            allowedge[k] = True
Severity: Major
Found in research/van_rantwijk/mwmatching.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if deltatype == -1 or d < delta:
                            delta = d
                            deltatype = 3
                            deltaedge = bestedge[b]
    
    
    Severity: Major
    Found in research/van_rantwijk/mwmatching.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if bk == -1 or d < bd:
                                  bk = k
                                  bd = d
                      if DEBUG and (bestedge[v] != -1 or bk != -1) and (bestedge[v] == -1 or bd != slack(bestedge[v])):
      Severity: Major
      Found in research/van_rantwijk/mwmatching.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if allowedge[k]:
                                if label[inblossom[w]] == 0:
                                    # (C1) w is a free vertex;
                                    # label w with T and label its mate with S (R12).
                                    assignLabel(w, 2, p ^ 1)
        Severity: Major
        Found in research/van_rantwijk/mwmatching.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if isinstance(kslack, integer_types):
                                  assert (kslack % 2) == 0
                                  d = kslack // 2
                              else:
                                  d = kslack / 2
          Severity: Major
          Found in research/van_rantwijk/mwmatching.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if inblossom[w] != b and label[inblossom[w]] == 1:
                                        d = slack(k)
                                        if bk == -1 or d < bd:
                                            bk = k
                                            bd = d
            Severity: Major
            Found in research/van_rantwijk/mwmatching.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if deltatype == -1 or d < delta:
                                      delta = d
                                      deltatype = 2
                                      deltaedge = bestedge[v]
              
              
              Severity: Major
              Found in research/van_rantwijk/mwmatching.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if label[b] == 1:
                                        # top-level S-blossom: z = z + 2*delta
                                        dualvar[b] += delta
                                    elif label[b] == 2:
                                        # top-level T-blossom: z = z - 2*delta
                Severity: Major
                Found in research/van_rantwijk/mwmatching.py - About 45 mins to fix

                  Method expand_t_blossom has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def expand_t_blossom(b)
                          assert(@label_end[b]).not_nil
                          entry_child = @in_blossom[@endpoint[@label_end[b] ^ 1]]
                  
                          # > Move along the blossom until we get to the base.
                  Severity: Minor
                  Found in lib/graph_matching/algorithm/mwm_general.rb - 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

                  Method blossom_leaves has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def blossom_leaves(b, ary = [])
                          if b < @nvertex
                            ary.push(b)
                          else
                            @blossom_children[b].each do |c|
                  Severity: Minor
                  Found in lib/graph_matching/algorithm/mwm_general.rb - 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

                  Method r has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def r(v, w, label, mate)
                          # R1. [Match v to w ] Set t <- MATE(v), MATE(v) <- w.
                          # If MATE(t) != v, return (the path is completely re-matched)
                  
                          t = mate[v]
                  Severity: Minor
                  Found in lib/graph_matching/algorithm/mcm_general.rb - 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

                  Method augment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def augment(m, path)
                          assert_valid_aug_path(path)
                          ix = 0
                          while ix < path.length
                            i = path[ix]
                  Severity: Minor
                  Found in lib/graph_matching/algorithm/mcm_bipartite.rb - 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

                  Method intersect? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def intersect?(set)
                        unless set.is_a?(Set)
                          raise ArgumentError, 'value must be a set'
                        end
                        if size < set.size
                  Severity: Minor
                  Found in lib/graph_matching/core_ext/set.rb - 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

                  Method consider_tight_edge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def consider_tight_edge(k, w, p, v)
                          augmented = false
                  
                          if @label[@in_blossom[w]] == LBL_FREE
                  
                  
                  Severity: Minor
                  Found in lib/graph_matching/algorithm/mwm_general.rb - 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

                  Method assign_label has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def assign_label(w, t, p = nil)
                          b = @in_blossom[w]
                          assert_label(w, LBL_FREE)
                          assert_label(b, LBL_FREE)
                          @label[w] = @label[b] = t
                  Severity: Minor
                  Found in lib/graph_matching/algorithm/mwm_general.rb - 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

                  Method gabow has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def self.gabow(mate)
                        m = new
                        mate.each_with_index do |n1, ix|
                          next if n1.nil? || n1 == 0
                          n2 = mate[n1]
                  Severity: Minor
                  Found in lib/graph_matching/matching.rb - 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