Showing 161 of 211 total issues
File geometry.py
has 570 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
Function _adaptive_sampler
has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
def _adaptive_sampler(f, z0, max_bend=10, max_z_rel=1e-3, max_df=0.05):
z0 = np.sort(z0)
zmin = min(z0)
zmax = max(z0)
- Read upRead up
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
File materials.py
has 389 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
Function diffraction_efficiencies
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def diffraction_efficiencies(
self,
N_d_order=0,
cplx_effs=False,
orders=False,
- Read upRead up
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
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
Geometry
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
class Geometry:
"""Base class for geometry models."""
def __init__(
self,
File grating2d.py
has 324 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
Function minimize
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def minimize(self, x0):
self.x0 = x0
if self.verbose:
mpi_print("#################################################")
mpi_print(f"Topology optimization with {self.nvar} variables")
- Read upRead up
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 diffraction_efficiencies
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def diffraction_efficiencies(
self,
N_order=0,
cplx_effs=False,
orders=False,
- Read upRead up
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 make_stack
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def make_stack(
geometry,
coefficients,
plane_wave,
polarization="TM",
- Read upRead up
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
Complex
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class Complex:
"""A complex object.
Parameters
----------
Function run
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run(polarization):
t2Dmesh = -time.time()
geom2D = build_geometry(2)
t2Dmesh += time.time()
simu2D = init_simu(geom2D, polarization)
File optimize.py
has 288 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
Function __init__
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(
self,
box_size=(1, 1, 1),
box_center=(0, 0, 0),
pml_width=(0.2, 0.2, 0.2),
File complex.py
has 276 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
Function read_mesh
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def read_mesh(mesh_file, data_dir=None, data_dir_xdmf=None, dim=3, subdomains=None):
data_dir_xdmf = data_dir_xdmf or tempfile.mkdtemp()
meshio_mesh = meshio.read(mesh_file, file_format="gmsh")
if dim == 3:
base_cell_type = "tetra"
- Read upRead up
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 _make_constant_property_2d
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def _make_constant_property_2d(prop, inv=False, real=False):
new_prop = {}
for d, p in prop.items():
lenp = _check_len(p)
if lenp > 0:
- Read upRead up
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 _topopt_wrapper
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def _topopt_wrapper(
self,
objfun,
Asub,
Actrl,
- Read upRead up
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
File scattering3d.py
has 251 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
Function __init__
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self,
model_name="geometry",
mesh_name="mesh.msh",
data_dir=None,
- Read upRead up
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"