tomography/xdesign

View on GitHub

Showing 54 of 127 total issues

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

    def quality(self, method="MSSSIM", L=1.0, **kwargs):
        """Compute the full-reference image quality of each image pair.

        Available methods include SSIM :cite:`wang:02`, MSSSIM :cite:`wang:03`,
        VIFp :cite:`Sheikh:15`
Severity: Minor
Found in src/xdesign/metrics/fullref.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 ssim has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def ssim(
    img1,
    img2,
    sigma=1.2,
    L=1,
Severity: Minor
Found in src/xdesign/metrics/fullref.py - About 1 hr to fix

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

        def __init__(
            self,
            steps=10,
            jitter=True,
            geometry=Square(center=Point([0.5, 0.5]), side_length=1)
    Severity: Minor
    Found in src/xdesign/phantom/standards.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 __init__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, n_sizes=5, size_ratio=0.5, n_shuffles=5):
            """
            Parameters
            ----------
            n_sizes : int
    Severity: Minor
    Found in src/xdesign/phantom/standards.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

                            if self.contains(other.center):
                                for edge in self.edges:
                                    if other.center.distance(edge) < other.radius:
                                        return False
                                return True
    Severity: Major
    Found in src/xdesign/geometry/area.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if self.contains(other.center):
                                  for edge in self.edges:
                                      if other.center.distance(edge) < other.radius:
                                          return False
                                  return True and not other.contains(-self)
      Severity: Major
      Found in src/xdesign/geometry/area.py - About 45 mins to fix

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

            def _get_attenuation(self, phantom):
                """Return the beam intensity attenuation due to the phantom."""
                intersection = beamintersect(self, phantom.geometry)
        
                if intersection is None or phantom.material is None:
        Severity: Minor
        Found in src/xdesign/acquisition.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 get_pie_glyphs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_pie_glyphs(xy, values, color='coverage', trace_normal=1, **kwargs):
            """Returns a list of pie glyphs at coordinates xy representing values
        
            The areas of the pie sectors are proportional to the elements of the
            vector that the glyph represents. The default color of the
        Severity: Minor
        Found in src/xdesign/plot.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

        Avoid too many return statements within this function.
        Open

                    return False
        Severity: Major
        Found in src/xdesign/codes.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                                  return (
          Severity: Major
          Found in src/xdesign/geometry/area.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                                        return True and not other.contains(-self)
            Severity: Major
            Found in src/xdesign/geometry/area.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return border.contains_points(np.atleast_2d(x))
              Severity: Major
              Found in src/xdesign/geometry/area.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return False
                Severity: Major
                Found in src/xdesign/codes.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                          return False
                  Severity: Major
                  Found in src/xdesign/geometry/area.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                            return (
                    Severity: Major
                    Found in src/xdesign/geometry/area.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                                  return True
                      Severity: Major
                      Found in src/xdesign/geometry/area.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                                return np.all(self.contains(x))
                        Severity: Major
                        Found in src/xdesign/geometry/area.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                                  return False
                          Severity: Major
                          Found in src/xdesign/geometry/area.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                                                return False
                            Severity: Major
                            Found in src/xdesign/geometry/area.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                                      return (
                              Severity: Major
                              Found in src/xdesign/geometry/area.py - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language