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
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 _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
Function __init__
has 15 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _topopt_wrapper
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def _topopt_wrapper(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function filtering
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def filtering(a, rfilt=0, function_space=None, degree=1, solver=None, mesh=None):
Function transfer_sub_mesh
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def transfer_sub_mesh(x, geometry, source_space, target_space, subdomain):
Function simp
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def simp(a, s_min=1, s_max=2, p=1, complex=True):
Function weak
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def weak(self, a):
self.mesh = a.function_space().mesh() if self._mesh is None else self._mesh
self.dim = self.mesh.ufl_domain().geometric_dimension()
self.function_space = self._function_space or df.FunctionSpace(
self.mesh, "CG", self.degree
- 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"