tomography/xdesign

View on GitHub

Showing 127 of 127 total issues

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

    def __repr__(self):
        return "Ellipse(center={}, a={}, b={})".format(
            repr(self.center), repr(self.a), repr(self.b)
Severity: Major
Found in src/xdesign/geometry/area.py and 2 other locations - About 45 mins to fix
src/xdesign/geometry/area.py on lines 149..151
src/xdesign/phantom/phantom.py on lines 156..158

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 35.

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

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

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

        @property
        def list(self):
            """Return an list of coordinates where p1 is the first D coordinates
            and p2 is the next D coordinates."""
            return np.concatenate((self.p1._x, self.p2._x), axis=0)
    Severity: Minor
    Found in src/xdesign/geometry/line.py and 1 other location - About 45 mins to fix
    src/xdesign/geometry/line.py on lines 93..96

    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 35.

    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

        @property
        def numpy(self):
            """Return row-size numpy array of p1 and p2."""
            return np.stack((self.p1._x, self.p2._x), axis=0)
    Severity: Minor
    Found in src/xdesign/geometry/line.py and 1 other location - About 45 mins to fix
    src/xdesign/geometry/line.py on lines 98..102

    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 35.

    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

    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

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

          def __repr__(self):
              return "Phantom(geometry={}, children={}, material={})".format(
                  repr(self.geometry), repr(self.children), repr(self.material)
      Severity: Major
      Found in src/xdesign/phantom/phantom.py and 2 other locations - About 45 mins to fix
      src/xdesign/geometry/area.py on lines 109..111
      src/xdesign/geometry/area.py on lines 149..151

      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 35.

      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

                  b = A[..., 0, 0] - A[..., 1, 0]
      Severity: Minor
      Found in src/xdesign/geometry/point.py and 1 other location - About 45 mins to fix
      src/xdesign/geometry/point.py on lines 94..94

      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 35.

      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

      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

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

          @property
          def center(self):
              """Return the centroid of the Phantom."""
              if self.geometry is None:
                  return None
      Severity: Minor
      Found in src/xdesign/phantom/phantom.py and 1 other location - About 35 mins to fix
      src/xdesign/phantom/phantom.py on lines 180..186

      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 33.

      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

      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

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

          @property
          def radius(self):
              """Return the radius of the smallest boundary sphere."""
              if self.geometry is None:
                  return None
      Severity: Minor
      Found in src/xdesign/phantom/phantom.py and 1 other location - About 35 mins to fix
      src/xdesign/phantom/phantom.py on lines 172..178

      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 33.

      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

      Avoid too many return statements within this function.
      Open

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

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

            if beam.distance(mesh.center) > mesh.radius:
                logger.debug("BEAMMESH: skipped because of radius.")
                return 0
        Severity: Minor
        Found in src/xdesign/acquisition.py and 1 other location - About 30 mins to fix
        src/xdesign/acquisition.py on lines 249..251

        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

        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

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

                if beam.distance(poly.center) > poly.radius:
                    logger.debug("BEAMPOLY: skipped because of radius.")
                    return 0
            Severity: Minor
            Found in src/xdesign/acquisition.py and 1 other location - About 30 mins to fix
            src/xdesign/acquisition.py on lines 235..237

            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

            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
                    Severity
                    Category
                    Status
                    Source
                    Language