Showing 2 of 46 total issues
Function clean
has a Cognitive Complexity of 19 (exceeds 15 allowed). Consider refactoring. Open
Open
def clean(self):
super().clean()
policy_name, params = self.cleaned_data.get('name'), self.cleaned_data.get('params')
required_params = GRADING_POLICY_NAME_TO_CLS.get(policy_name).require.get('params')
if required_params:
- 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 sequence_item_next
has a Cognitive Complexity of 17 (exceeds 15 allowed). Consider refactoring. Open
Open
def sequence_item_next(request, pk):
try:
next_forbidden, last_item, sequence_item = _check_next_forbidden(pk)
except SequenceItem.DoesNotExist:
log.exception("SequenceItem which supposed to exist can't be found!")
- 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"