benvial/gyptis

View on GitHub

Showing 211 of 211 total issues

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

    def __init__(
Severity: Major
Found in src/gyptis/models/scattering3d.py - About 1 hr to fix

    Function __init__ has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def __init__(
            self,
            vectors,
            periodic_tol=1e-8,
            **kwargs,
    Severity: Minor
    Found in src/gyptis/geometry/phc3d.py - About 1 hr to fix

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

                  if source_dom_no_func != []:
                      form += self.maxwell(
                          u1,
                          v,
                          epsilon - epsilon_a,
      Severity: Major
      Found in src/gyptis/formulations/maxwell3d.py and 1 other location - About 1 hr to fix
      src/gyptis/formulations/maxwell2d.py on lines 102..104

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

      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

                  if source_dom_no_func != []:
                      form += self.maxwell(
                          u1, v, xi - xi_a, chi - chi_a, domain=source_dom_no_func
      Severity: Major
      Found in src/gyptis/formulations/maxwell2d.py and 1 other location - About 1 hr to fix
      src/gyptis/formulations/maxwell3d.py on lines 97..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 42.

      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 build_geometry has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def build_geometry(wavelength, pmesh):
          thicknesses = OrderedDict(
              {
                  "pml_bottom": wavelength,
                  "substrate": wavelength * 1,
      Severity: Minor
      Found in examples/diffraction/plot_silver_core_shell_grating.py - About 1 hr to fix

        Function __init__ has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def __init__(
                self,
                model_name="geometry",
                mesh_name="mesh.msh",
                data_dir=None,
        Severity: Minor
        Found in src/gyptis/geometry/geometry.py - About 1 hr to fix

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

              def __init__(
          Severity: Major
          Found in src/gyptis/formulations/maxwell2d.py - About 1 hr to fix

            Function _make_tensor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            def _make_tensor(mapping):
                mapping_tens = mapping.copy()
                N = max(len(v) for v in mapping.values() if isiter(v))
                idf = np.eye(N).tolist()
                for k, v in mapping.items():
            Severity: Minor
            Found in src/gyptis/materials.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 set_mesh_size has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                def set_mesh_size(self, params, dim=None):
                    dim = self._check_dim(dim)
                    if dim == 3:
                        type_entity = "volumes"
                    elif dim == 2:
            Severity: Minor
            Found in src/gyptis/geometry/geometry.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 __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(
            Severity: Major
            Found in src/gyptis/sources/gaussian.py - About 1 hr to fix

              Function get_T_matrix has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def get_T_matrix(
                      self,
                      p_max,
                      degree_source=None,
                      component="transverse",
              Severity: Minor
              Found in src/gyptis/models/scattering3d.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 __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(
              Severity: Major
              Found in src/gyptis/models/scattering2d.py - About 1 hr to fix

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

                    def __init__(
                Severity: Major
                Found in src/gyptis/models/grating3d.py - About 1 hr to fix

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

                      def plot_field(
                  Severity: Major
                  Found in src/gyptis/models/grating2d.py - About 1 hr to fix

                    Function P has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def P(x, n, m, y=None):
                        y = y or sqrt_safe(1 - x**2)
                        if m < 0:
                            return (-1) ** (-m) * P(x, n, -m)
                        elif n == m == 0:
                    Severity: Minor
                    Found in src/gyptis/sources/spharm.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 run has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def run(polarization):
                        t2Dmesh = -time.time()
                        geom2D = build_geometry(2)
                        t2Dmesh += time.time()
                        simu2D = init_simu(geom2D, polarization)
                    Severity: Minor
                    Found in examples/diffraction/plot_2d_to_3d_grating.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 process_html has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def process_html(fn, lines):
                        new_lines = []
                        for line in lines:
                            # Remove escaped arguments from the html files.
                            line = line.replace(r"\*args", "*args")
                    Severity: Minor
                    Found in docs/postprocess.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 __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def __init__(
                    Severity: Major
                    Found in src/gyptis/models/hc2d.py - About 1 hr to fix

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

                          def __init__(
                      Severity: Major
                      Found in src/gyptis/geometry/geometry.py - About 1 hr to fix

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

                            def __init__(
                        Severity: Major
                        Found in src/gyptis/models/twoscale2d.py - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language