Showing 28 of 47 total issues
Avoid deeply nested control flow statements. Open
Open
if not callable(validator):
raise ValueError(
"Validator must be a function")
text = self.text
Avoid deeply nested control flow statements. Open
Open
if not answered:
ask_text = "Please answer again: "
self.text = text
Function confirm
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def confirm(
Function select
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def select(self,
Function box
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def box(self, obj, theme="box", transform=None, humanize=True, **kwargs):
Function unitext
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def unitext(self, obj, theme=None, transform=None,
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self, format_only=False, default_prefix="",
Function section
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def section(
self,
obj,
theme="section",
transform=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"