Showing 38 of 284 total issues
Function parse_query
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_query(cls, cols, args, filter=None):
# order[0][column]=0&order[0][dir]=desc&start=0&length=5
order = [
(int(a[0].groups()[0]), a[0].groups()[1], a[1])
for a in [(order_re.match(x[0]), x[1]) for x in args.items()]
- 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 validate_to
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def validate_to(_, field): # TODO: This code is UGLY (like the Predator)!
"""Validates the recipient list"""
txt = field.data
if not "," in txt:
if not ("@" in txt and "." in txt):
- 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 encode
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def encode(self, message: str | bytes) -> bytes:
"""Encodes a message according to the encoding of this enum value
Returns the parameter unchanged if already bytes.
- 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 find_unused_port
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def find_unused_port(cls) -> int:
"""Returns a port within the range specified in the configuration"""
port_range = range(
config.REFERENCE_PORT_RANGE[0], config.REFERENCE_PORT_RANGE[1] + 1
)
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Consider simplifying this complex logical expression. Open
if (
row["time"] == ""
or row["body"] == ""
or row["output"] == ""
or row["encoding"] == ""
Function _render_form
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _render_form(
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function _score
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _score(self, team: Team, datapoint: DataPoint, scoring_key, force=False):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, pre_classes="", *args, **kwargs):
Avoid too many return
statements within this function. Open
return redirect(url_for(".beacon_table"))
Avoid too many return
statements within this function. Open
return abort(403)
Avoid too many return
statements within this function. Open
return redirect(url_for(".admin_home"))
Avoid too many return
statements within this function. Open
return render_template("regclosed.html.jinja2")
Function send
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def send(self) -> bool:
"""Sends the message.
Or at least tries to.
Returns True if we think it worked."""
- 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 configure_db
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def configure_db(app=None):
"""Configures the database"""
# Configure MongoDB:
driver = os.environ.get("MONGODB_DRIVER", "mongodb")
- 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"