Showing 46 of 108 total issues
Function solve
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def solve(self):
""" Solve the model
Returns:
:obj:`Result`: result
- 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 get_type
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def get_type(self):
""" Get the type of the model
Returns:
:obj:`ModelType`: model type
- 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 solve
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def solve(self):
""" Solve the model
Returns:
:obj:`Result`: result
- 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 export
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def export(self, filename, format=None, solver=None):
""" Export a model to a file in one of these support formats
* **alp**: model with generic names in lp format, where the variable names are annotated to indicate the type and bounds of each variable
* **cbf**
- 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 convert
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def convert(self, options=None):
""" Generate a data structure for the model for another package
Args:
options (:obj:`SolveOptions`, optional): options
- 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
Consider simplifying this complex logical expression. Open
if Solver.cbc in preferred_solvers and format in ['lp']:
from .solver import cbc
simplex = cbc.CbcModel(self).get_model()
simplex.writeLp(filename)
elif Solver.cbc in preferred_solvers and format in ['mps']:
Function solve
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def solve(self):
""" Solve the model
Returns:
:obj:`Result`: result
- 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 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load(self, conv_opt_model):
""" Load a model to MINOS' data structure
Args:
conv_opt_model (:obj:`Model`): model
Function solve
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def solve(self):
""" Solve the model
Returns:
:obj:`Result`: result
Consider simplifying this complex logical expression. Open
if constraint.lower_bound is None and constraint.upper_bound is None:
raise ConvOptError('Constraints must have at least one bound')
elif constraint.lower_bound is None:
solver_model.addConstr(lhs, gurobipy.GRB.LESS_EQUAL, constraint.upper_bound, name=constraint.name or '')
elif constraint.upper_bound is None:
Function solve
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def solve(self, options=None):
""" Solve the model
Args:
options (:obj:`SolveOptions`, optional): options
- 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 solve
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def solve(self):
""" Solve the model
Returns:
:obj:`Result`: result
- 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 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, solver=Solver.cplex, tune=False, presolve=Presolve.off, precision=64,
Avoid deeply nested control flow statements. Open
if range_constraint:
cobra_model.reactions[i_reaction]._metabolites[met2] += term.coefficient
else:
Avoid deeply nested control flow statements. Open
if range_constraint:
cobra_model.reactions[i_reaction]._metabolites[met2] = term.coefficient
else:
Function makeME_LP
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def makeME_LP(S, b, c, xl, xu, csense):
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, status_code, status_message, value, primals, reduced_costs, duals):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name='', variables=None, objective_direction=ObjectiveDirection.minimize, objective_terms=None, constraints=None):
Avoid too many return
statements within this function. Open
return minos.MinosModel(self, options)
Avoid too many return
statements within this function. Open
return mosek.MosekModel(self, options)