cms/forms/widgets.py
Function create_option
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def create_option(self, name, value, label, selected, index, subindex=None, attrs=None):
Function render
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def render(self, name, value, attrs=None, choices=(), renderer=None):
Function _has_changed
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def _has_changed(self, initial, data):
# THIS IS A COPY OF django.forms.widgets.Widget._has_changed()
# (except for the first if statement)
"""
- 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 _build_option
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def _build_option(self, selected_choices, option_value, option_label):
if option_value is None:
option_value = ''
option_value = force_str(option_value)
if option_value in selected_choices:
- 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"