benvial/gyptis

View on GitHub

Showing 211 of 211 total issues

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

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

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

        def plot_field(
    Severity: Major
    Found in src/gyptis/models/scattering2d.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/formulations/maxwell3d.py - About 1 hr to fix

        Function eigensolve has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def eigensolve(
                self,
                n_eig=6,
                wavevector_target=0.0,
                tol=1e-6,
        Severity: Minor
        Found in src/gyptis/models/simulation.py - About 1 hr to fix

          Function callback has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def callback(self):
              global jopt
              proj = self.proj_level is not None
              filt = self.filter != 0
              density_fp = density_proj_filt(self, self.density, proj, filt, filtering_type)
          Severity: Minor
          Found in tutorials/optimization/plot_optim.py - About 1 hr to fix

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

                def map(self, x, y):
                    v = self.vectors
            
                    def set_coord(x, y):
                        for i in range(3):
            Severity: Minor
            Found in src/gyptis/bc.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 _weak has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                def _weak(self, u, v, u1):
                    epsilon = self.epsilon.as_subdomain()
                    inv_mu = self.mu.invert().as_subdomain()
            
                    epsilon_dict = self.epsilon.as_property()
            Severity: Minor
            Found in src/gyptis/formulations/maxwell3d.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

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

                    return [f.real + f.imag for f in form] if self.modal else form.real + form.imag
            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 119..119

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

            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

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

                    return [f.real + f.imag for f in form] if self.modal else form.real + form.imag
            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 113..113

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

            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 postpro_download_links has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            def postpro_download_links(fn):
                sgfoot = None
                with open(fn, "r") as file:
                    soup = BeautifulSoup(file, "html.parser")
                for item in soup.findAll(["div"]):
            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 create_geometry has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def create_geometry(wavelength, pml_width):
                R1 = 60
                R2 = 30
                Rcalc = 2 * R1
                lmin = wavelength / pmesh
            Severity: Minor
            Found in examples/scattering/plot_silver_core_shell.py - About 1 hr to fix

              Function plane_wave_3d has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

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

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

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

                  Function get_T_matrix_coeff has 8 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

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

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

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

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

                      gy.plot(hom.solution["epsilon"]["y"].real, geometry=lattice, ax=ax[1])
                      Severity: Major
                      Found in examples/homogenization/plot_homogenization.py and 1 other location - About 1 hr to fix
                      examples/homogenization/plot_homogenization.py on lines 75..75

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

                      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

                      gy.plot(hom.solution["epsilon"]["x"].real, geometry=lattice, ax=ax[0])
                      Severity: Major
                      Found in examples/homogenization/plot_homogenization.py and 1 other location - About 1 hr to fix
                      examples/homogenization/plot_homogenization.py on lines 76..76

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

                      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_periodic_bnds has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def get_periodic_bnds(self):
                              verts = self.vertices
                              # get all boundaries
                              bnds = self.get_entities(2)
                              maps = []
                      Severity: Minor
                      Found in src/gyptis/geometry/phc3d.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 field_stack_3D has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def field_stack_3D(phi, alpha, beta, gamma, zshift=0, degree=1, domain=None):
                      Severity: Major
                      Found in src/gyptis/sources/stack.py - About 50 mins to fix

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

                        def plot_real(
                        Severity: Major
                        Found in src/gyptis/plot.py - About 50 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language