Showing 11 of 19 total issues
Subscription
has 41 functions (exceeds 25 allowed). Consider refactoring. Open
class Subscription(Billable, SimpleStateModel):
'''
One Subscription that may be shared among several people.
'''
depot = models.ForeignKey(
Function job
has a Cognitive Complexity of 35 (exceeds 15 allowed). Consider refactoring. Open
def job(request, job_id):
'''
Details for a job
'''
member = request.user.member
- 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
Consider simplifying this complex logical expression. Open
if (c == 'N' and g == 'M') or ((c == 'G' or c == 'D') and g == 'F'):
article = _('der')
elif c == 'G' and (g == 'M' or g == 'N'):
article = _('des')
elif c == 'D' and (g == 'M' or g == 'N'):
Member
has 26 functions (exceeds 25 allowed). Consider refactoring. Open
class Member(JuntagricoBaseModel):
'''
Additional fields for Django's default user class.
'''
Function set_up_job
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_up_job(self):
"""
job_type
"""
job_type_data = {'name': 'nameot',
Function excel_export_subscriptions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def excel_export_subscriptions(request):
response = HttpResponse(content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
response['Content-Disposition'] = 'attachment; filename=Report.xlsx'
output = BytesIO()
workbook = Workbook(output)
Function handle
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle(self, *args, **options):
subprod_field = {'name': 'Gemüse'}
sub_product, created = SubscriptionProduct.objects.get_or_create(**subprod_field)
subsize_fields = {'name': 'Normales Abo', 'long_name': 'Ganz Normales Abo', 'units': options['sub_size'],
Function mass_edit_share_dates
has a Cognitive Complexity of 19 (exceeds 15 allowed). Consider refactoring. Open
def mass_edit_share_dates(self, request, queryset):
if 'apply' in request.POST:
form = EditShareDatesForm(request.POST)
if form.is_valid():
target_field = form.cleaned_data['target_field']
- 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 enriched_organisation
has a Cognitive Complexity of 19 (exceeds 15 allowed). Consider refactoring. Open
def enriched_organisation(c):
g = Config.organisation_name_config()['gender'].upper()
if (c == 'N' and g == 'M') or ((c == 'G' or c == 'D') and g == 'F'):
article = _('der')
elif c == 'G' and (g == 'M' or g == 'N'):
- 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
Avoid too many return
statements within this function. Open
return 'cs-shares'
Avoid too many return
statements within this function. Open
return 'cs-summary'