benvial/gyptis

View on GitHub
src/gyptis/sources/stack.py

Summary

Maintainability
D
1 day
Test Coverage

File stack.py has 369 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Benjamin Vial
# This file is part of gyptis
# Version: 1.0.2
Severity: Minor
Found in src/gyptis/sources/stack.py - About 4 hrs to fix

    Function make_stack has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def make_stack(
        geometry,
        coefficients,
        plane_wave,
        polarization="TM",
    Severity: Minor
    Found in src/gyptis/sources/stack.py - About 3 hrs 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 solve has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def solve(thicknesses, eps, mu, lambda0, theta0, phi0, psi0):
        k0 = 2 * pi / lambda0
        omega = k0 * c
    
        alpha0 = -k0 * np.sin(theta0) * np.cos(phi0)
    Severity: Minor
    Found in src/gyptis/sources/stack.py - About 1 hr to fix

      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 make_stack has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def make_stack(
        Severity: Major
        Found in src/gyptis/sources/stack.py - About 50 mins to fix

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

          def solve(thicknesses, eps, mu, lambda0, theta0, phi0, psi0):
          Severity: Major
          Found in src/gyptis/sources/stack.py - About 50 mins to fix

            Function field_stack_2D has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def field_stack_2D(phi, alpha, beta, yshift=0, degree=1, domain=None):
            Severity: Minor
            Found in src/gyptis/sources/stack.py - About 45 mins to fix

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

              def get_stack_efficiencies(thicknesses, epsilon, mu, lambda0, angles):
              Severity: Minor
              Found in src/gyptis/sources/stack.py - About 35 mins to fix

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

                def get_coeffs_stack(config, lambda0, theta0, phi0, psi0):
                Severity: Minor
                Found in src/gyptis/sources/stack.py - About 35 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status