CellProfiler/centrosome

View on GitHub
centrosome/lapjv.py

Summary

Maintainability
D
2 days
Test Coverage

Function slow_augment has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

def slow_augment(n, ii, jj, idx, count, x, y, u, v, c):
    """Perform the augmentation step to assign unassigned i and j
    
    n - the # of i and j, also the marker of unassigned x and y
    ii - the unassigned i
Severity: Minor
Found in centrosome/lapjv.py - About 7 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 lapjv has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def lapjv(i, j, costs, wants_dual_variables=False, augmenting_row_reductions=2):
    """Sparse linear assignment solution using Jonker-Volgenant algorithm
    
    i,j - similarly-sized vectors that pair the object at index i[n] with
          the object at index j[j]
Severity: Minor
Found in centrosome/lapjv.py - About 1 hr to fix

    Function slow_augmenting_row_reduction has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def slow_augmenting_row_reduction(n, ii, jj, idx, count, x, y, u, v, c):
    Severity: Major
    Found in centrosome/lapjv.py - About 1 hr to fix

      Function slow_augment has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def slow_augment(n, ii, jj, idx, count, x, y, u, v, c):
      Severity: Major
      Found in centrosome/lapjv.py - About 1 hr to fix

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

        def slow_augmenting_row_reduction(n, ii, jj, idx, count, x, y, u, v, c):
            """Perform the augmenting row reduction step from the Jonker-Volgenaut algorithm
            
            n - the number of i and j in the linear assignment problem
            ii - the unassigned i
        Severity: Minor
        Found in centrosome/lapjv.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 slow_reduction_transfer has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def slow_reduction_transfer(ii, j, idx, count, x, u, v, c):
        Severity: Major
        Found in centrosome/lapjv.py - About 1 hr to fix

          Avoid deeply nested control flow statements.
          Open

                                  if h == umin:
                                      if y[j1] == n:
                                          raise StopIteration()
                                      print("Add to scan")
                                      scan += [j1]
          Severity: Major
          Found in centrosome/lapjv.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if y[j1] == n:
                                        raise StopIteration()
                            j1 = scan[0]
            Severity: Major
            Found in centrosome/lapjv.py - About 45 mins to fix

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

              def lapjv(i, j, costs, wants_dual_variables=False, augmenting_row_reductions=2):
              Severity: Minor
              Found in centrosome/lapjv.py - About 35 mins to fix

                Function lapjv has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def lapjv(i, j, costs, wants_dual_variables=False, augmenting_row_reductions=2):
                    """Sparse linear assignment solution using Jonker-Volgenant algorithm
                    
                    i,j - similarly-sized vectors that pair the object at index i[n] with
                          the object at index j[j]
                Severity: Minor
                Found in centrosome/lapjv.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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        uu = np.min((c[idx[i] : (idx[i] + count[i])] - v[jj])[jj != j1])
                Severity: Major
                Found in centrosome/lapjv.py and 1 other location - About 1 hr to fix
                centrosome/lapjv.py on lines 227..227

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 45.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                        uu = c[idx[i] : (idx[i] + count[i])] - v[j]
                Severity: Major
                Found in centrosome/lapjv.py and 1 other location - About 1 hr to fix
                centrosome/lapjv.py on lines 177..177

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 45.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 4 locations. Consider refactoring.
                Open

                        jj = j[idx[i] : (idx[i] + count[i])]
                Severity: Major
                Found in centrosome/lapjv.py and 3 other locations - About 55 mins to fix
                centrosome/cpmorphology.py on lines 4111..4111
                centrosome/lapjv.py on lines 226..226
                centrosome/lapjv.py on lines 312..312

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 37.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 4 locations. Consider refactoring.
                Open

                        j = jj[idx[i] : (idx[i] + count[i])]
                Severity: Major
                Found in centrosome/lapjv.py and 3 other locations - About 55 mins to fix
                centrosome/cpmorphology.py on lines 4111..4111
                centrosome/lapjv.py on lines 176..176
                centrosome/lapjv.py on lines 226..226

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 37.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 4 locations. Consider refactoring.
                Open

                        j = jj[idx[i] : (idx[i] + count[i])]
                Severity: Major
                Found in centrosome/lapjv.py and 3 other locations - About 55 mins to fix
                centrosome/cpmorphology.py on lines 4111..4111
                centrosome/lapjv.py on lines 176..176
                centrosome/lapjv.py on lines 312..312

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 37.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                                u1 = c[iii, j1] - v[j1] - umin
                Severity: Minor
                Found in centrosome/lapjv.py and 1 other location - About 30 mins to fix
                centrosome/lapjv.py on lines 339..339

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 32.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                                    h = c[iii, j1] - v[j1] - u1
                Severity: Minor
                Found in centrosome/lapjv.py and 1 other location - About 30 mins to fix
                centrosome/lapjv.py on lines 337..337

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 32.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                There are no issues that match your filters.

                Category
                Status