Showing 5 of 13 total issues
Function expire_on
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def expire_on(self):
try:
end_date = datetime.min
- Read upRead up
- Create a ticketCreate a ticket
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
File models.py
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- encoding: utf-8 -*- #
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
- Create a ticketCreate a ticket
Function save
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def save(self, *args, **kwargs):
# can't have an empty sidebar...
if self.sidebar_left is None or len(self.sidebar_left) == 0:
if not isinstance(settings.SIDEBAR_LEFT, list):
self.sidebar_left = [u'survey-form', u'cov', ]
- Read upRead up
- Create a ticketCreate a ticket
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
Avoid deeply nested control flow statements. Open
if montant >= yearly_paying_months * unit_price:
virt_amount += 12 * unit_price
montant -= yearly_paying_months * unit_price
else:
virt_amount += montant
- Create a ticketCreate a ticket
Function process_request
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_request(self, request):
user = request.user
if not user.is_authenticated():
for groupname, ranges in settings.IP_AUTH_GROUPS.iteritems():
- Read upRead up
- Create a ticketCreate a ticket
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"