Showing 15 of 36 total issues
File __main__.py
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Command line interface for emigrate."""
from .__version__ import __version__
from .Solver import Solver
from .Frame import Frame
from .Sequence import Sequence
Function solve
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def solve(ctx, output, dt, time, io):
solver = Solver(ctx.obj['frame'])
if io:
for frame in solver.iterate(output, dt, time):
- 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
SLIP
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class SLIP(Fluxer):
"""A compact flux solver with numerical dissipation and adaptive grid."""
# #TODO:60 hide internal functions
Function construct
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def construct(ctx, infile, output, io):
if io:
for constructor in iter(sys.stdin.readline, ''):
constructor = deserialize(constructor)
save = 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 load
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def load(ctx, path, io):
"""Open an emgrate file and return a serialized frame."""
ctx.obj['path'] = path
_, file_extension = os.path.splitext(path)
if file_extension == '.hdf5':
- 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 __setitem__
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def __setitem__(self, idx, frame):
if not isinstance(idx, int):
raise IndexError('Sequence index must be an integer.')
if str(idx-1) not in self._frames().keys() and self._frames().keys():
- 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
Avoid deeply nested control flow statements. Open
if i == 10:
i = 0
bar.update(-10)
bar.update(1)
Function solve
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def solve(ctx, output, dt, time, io):
Function movie
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def movie(ctx, field, ymax):
metadata = dict(title='Movie Test', artist='Matplotlib',
comment='Movie support!')
writer = FFMpegWriter(fps=15, metadata=metadata)
- 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 _create_concentrations
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _create_concentrations(self, constructor):
self.concentrations = []
for ion in self.ions:
ion_concentration = np.zeros(self.nodes.shape)
- 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 iterate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def iterate(self, path='default.hdf5', interval=1., max_time=None):
with Sequence(path, mode='w') as sequence:
sequence.append(self.state)
self._initialize_solver()
while self.solver.successful():
- 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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, state):
"""Initialize the compact flux solver."""
self.state = state
# Prepare the grid points from the state nodes
- 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 __getitem__
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __getitem__(self, idx):
if not isinstance(idx, int):
raise IndexError('Sequence index must be an integer.')
if idx < 0: idx = len(self) + idx
- 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 gram
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def gram(ctx, location):
sequence = ctx.obj['sequence']
frame0 = sequence[0]
times = [f.time for f in sequence]
# nodes = np.linspace(frame0.nodes[0], frame0.nodes[-1], n)
- 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 _ensure_positive
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _ensure_positive(self, roots, polys):
if self.enforce_positive:
for idx, value in enumerate(roots < 0):
if value:
roots[idx] = self._1d_analytical_solve(polys[:, idx])
- 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"