CellProfiler/centrosome

View on GitHub

Showing 123 of 380 total issues

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

def poisson_equation(
    image, gradient=1, max_iter=100, convergence=0.01, percentile=90.0
):
    """Estimate the solution to the Poisson Equation

Severity: Minor
Found in centrosome/filter.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 ellipse_from_second_moments_ijv has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def ellipse_from_second_moments_ijv(
    i, j, image, labels, indexes, wants_compactness=False
):
    """Calculate measurements of ellipses equivalent to the second moments of labels
    
Severity: Minor
Found in centrosome/cpmorphology.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 calculate_costs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def calculate_costs(self, detections_1, detections_2, calculate_match_cost, params):
        """
        Calculates assignment costs between detections and 'empty' spaces. The smaller cost the better.

        @param detections_1: cell list of size n in previous frame
Severity: Minor
Found in centrosome/neighmovetrack.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 feret_diameter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def feret_diameter(chulls, counts, indexes):
    """Return the minimum and maximum Feret diameter for each object
    
    This function takes the convex hull data, as generated by convex_hull
    and returns the minimum and maximum Feret diameter for each convex hull.
Severity: Minor
Found in centrosome/cpmorphology.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 bg_compensate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def bg_compensate(img, sigma, splinepoints, scale):
    """Reads file, subtracts background. Returns [compensated image, background]."""

    from PIL import Image
    import pylab
Severity: Minor
Found in centrosome/bg_compensate.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 get_robust_background_threshold has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def get_robust_background_threshold(
Severity: Major
Found in centrosome/threshold.py - About 50 mins to fix

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

        def __init__(
    Severity: Major
    Found in centrosome/filter.py - About 50 mins to fix

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

      def ellipse_from_second_moments_ijv(
      Severity: Minor
      Found in centrosome/cpmorphology.py - About 45 mins 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 neighbor_value < current_value:
                                  mask_value = values[neighbor + image_stride]
                                  # Only do neighbors less than the mask value
                                  if neighbor_value < mask_value:
                                      # Raise the neighbor to the mask value if
          Severity: Major
          Found in centrosome/cpmorphology.py - About 45 mins to fix

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

                def __init__(self, image, labels, scale_i, scale_j, nlevels=8, mask=None):
            Severity: Minor
            Found in centrosome/haralick.py - About 45 mins to fix

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

              def entropy(data, bins=256):
                  """Compute a threshold using Ray's entropy measurement
                  
                  data           - an array of intensity values between zero and one
                  bins           - we bin the data into this many equally-spaced bins, then pick
              Severity: Minor
              Found in centrosome/otsu.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 find_visible has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def find_visible(hull, observer, background):
                  """Given an observer location, find the first and last visible
                     points in the hull
                     
                     The observer at "observer" is looking at the hull whose most distant
              Severity: Minor
              Found in centrosome/cpmorphology.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 label_skeleton has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def label_skeleton(skeleton):
                  """Label a skeleton so that each edge has a unique label
                  
                  This operation produces a labels matrix where each edge between
                  two branchpoints has a different label. If the skeleton has been
              Severity: Minor
              Found in centrosome/cpmorphology.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

              Avoid deeply nested control flow statements.
              Open

                                  for adjacent_i, adjacent_j in (
                                      (ii - 1, jj),
                                      (ii, jj - 1),
                                      (ii + 1, jj),
                                      (ii, jj + 1),
              Severity: Major
              Found in centrosome/cpmorphology.py - About 45 mins to fix

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

                def binary_shrink(image, iterations=-1):
                    """Shrink an image by repeatedly removing pixels which have partners
                       above, to the left, to the right and below until the image doesn't change
                       
                       image - binary image to be manipulated
                Severity: Minor
                Found in centrosome/cpmorphology.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 lines_intersect has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                def lines_intersect(pt1_p, pt2_p, pt1_q, pt2_q):
                    """Return true if two line segments intersect
                    pt1_p, pt2_p - endpoints of first line segment
                    pt1_q, pt2_q - endpoints of second line segment
                    """
                Severity: Minor
                Found in centrosome/cpmorphology.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 bilateral_filter has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def bilateral_filter(
                Severity: Minor
                Found in centrosome/filter.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if neighbor < 0:
                                          raise IndexError(
                                              "Index out of bounds: %d, current=%d, current_value=%d"
                                              % (neighbor, np.unravel_index(current, dims), current_value)
                                          )
                  Severity: Major
                  Found in centrosome/cpmorphology.py - About 45 mins to fix

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

                    def splinefit2d(x, y, z, px, py, mask=None):
                    Severity: Minor
                    Found in centrosome/bg_compensate.py - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language