benvial/gyptis

View on GitHub

Showing 161 of 211 total issues

Avoid deeply nested control flow statements.
Open

                    if znew not in z:
                        z.append(znew)
                        tnew = f(znew)
                        if multi_output:
                            t.append(tnew[0])
Severity: Major
Found in src/gyptis/utils/sample.py - About 45 mins to fix

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

        def get_boundaries(self, idf, dim=None, physical=True):
            dim = self._check_dim(dim)
            if isinstance(idf, str):
                if dim == 2:
                    type_entity = "surfaces"
    Severity: Minor
    Found in src/gyptis/geometry/geometry.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 callable(k):
                            const = False
                            break
                # if p.shape != (2, 2):
                #     p = p[:2][:2]
    Severity: Major
    Found in src/gyptis/materials.py - About 45 mins to fix

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

      def plot_bands(
          sym_points,
          nband,
          eigenvalues,
          xtickslabels=None,
      Severity: Minor
      Found in src/gyptis/utils/bands.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 main has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def main():
          p = optparse.OptionParser(__doc__)
          options, args = p.parse_args()
      
          if len(args) < 1:
      Severity: Minor
      Found in docs/postprocess.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 _cplx_iter has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def _cplx_iter(f):
          def wrapper(v, *args, **kwargs):
              iterable = isinstance(v, Iterable)
              cplx = any(iscomplex(v_) for v_ in v) if iterable else iscomplex(v)
              if cplx:
      Severity: Minor
      Found in src/gyptis/complex.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

      Consider simplifying this complex logical expression.
      Open

              if ison0 and ison1 and ison2:
                  y = set_coord(x - v[0] - v[1] - v[2], y)
      
              elif ison0 and ison2:
                  y = set_coord(x - v[0] - v[2], y)
      Severity: Major
      Found in src/gyptis/bc.py - About 40 mins to fix

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

            def rotate(self, tag, point, axis, angle, dim=None):
        Severity: Minor
        Found in src/gyptis/geometry/geometry.py - About 35 mins to fix

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

          def _adaptive_sampler(f, z0, max_bend=10, max_z_rel=1e-3, max_df=0.05):
          Severity: Minor
          Found in src/gyptis/utils/sample.py - About 35 mins to fix

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

                def __new__(cls, markers, subdomains, mapping, cpp=True, **kwargs):
            Severity: Minor
            Found in src/gyptis/materials.py - About 35 mins to fix

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

                  def __new__(cls, markers, subdomains, mapping, cpp=True, **kwargs):
              Severity: Minor
              Found in src/gyptis/materials.py - About 35 mins to fix

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

                    def diffraction_efficiencies(
                Severity: Minor
                Found in src/gyptis/models/grating2d.py - About 35 mins to fix

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

                      def __init__(
                  Severity: Minor
                  Found in src/gyptis/geometry/scattering3d.py - About 35 mins to fix

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

                        def maxwell(self, u, v, xi, chi, domain="everywhere"):
                    Severity: Minor
                    Found in src/gyptis/formulations/maxwell2d.py - About 35 mins to fix

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

                          def __new__(cls, markers, subdomains, mapping, cpp=True, **kwargs):
                      Severity: Minor
                      Found in src/gyptis/materials.py - About 35 mins to fix

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

                        def plot_rods(ax, rod_positions, rod_radii, *args, **kwargs):
                        Severity: Minor
                        Found in dev/gen_bg.py - About 35 mins to fix

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

                          def read_mesh(mesh_file, data_dir=None, data_dir_xdmf=None, dim=3, subdomains=None):
                          Severity: Minor
                          Found in src/gyptis/mesh/mesh.py - About 35 mins to fix

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

                            def simp(a, s_min=1, s_max=2, p=1, complex=True):
                            Severity: Minor
                            Found in src/gyptis/optimize.py - About 35 mins to fix

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

                                  def __new__(self, markers, subdomains, mapping, cpp=True, **kwargs):
                              Severity: Minor
                              Found in src/gyptis/materials.py - About 35 mins to fix

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

                                def plot_arrow(a, x, y, dx, dy):
                                Severity: Minor
                                Found in examples/sources/plot_sources.py - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language