Showing 45 of 197 total issues
File serviceform.py
has 526 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# (c) 2017 Tuomas Airaksinen
#
# This file is part of Serviceform.
#
Function clean
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
def clean(self):
for key, value in self.post_data.items():
if key.startswith('SRV_'):
parts = key.split('_')
if 'EXTRA' in parts:
- 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
File forms.py
has 470 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# (c) 2017 Tuomas Airaksinen
#
# This file is part of Serviceform.
#
Function shuffle_person_data
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
def shuffle_person_data(service_form: 'ServiceForm') -> None:
from .models import Participant, ResponsibilityPerson, Question
letters = len(string.ascii_letters)
forenames = set()
surnames = set()
- 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 init_serviceform_counters
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def init_serviceform_counters(service_form: 'ServiceForm', all_responsibles: bool=True) -> None:
"""
Initializes counters and collects responsibles from subitems
:return:
- 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 areYouSure
has 144 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.areYouSure = function(options) {
var settings = $.extend(
{
'message' : 'You have unsaved changes!',
Function menu_items
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def menu_items(context: Context, menu_name: str) -> MenuItems:
"""
This is used for:
- Reports menu
- Participation password_login page menu
- 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
File utils.py
has 307 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# (c) 2017 Tuomas Airaksinen
#
# This file is part of Serviceform.
#
File people.py
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# (c) 2017 Tuomas Airaksinen
#
# This file is part of Serviceform.
#
File settings.py
has 285 lines of code (exceeds 250 allowed). Consider refactoring. Open
import os
import socket
import sys
from logging.config import dictConfig
from django.utils.translation import ugettext_lazy as _
Participant
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class Participant(ContactDetailsMixin, PasswordMixin, models.Model):
email: str
class Meta:
verbose_name = _('Participant')
File admin.py
has 282 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# (c) 2017 Tuomas Airaksinen
#
# This file is part of Serviceform.
#
Function require_authenticated_participant
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def require_authenticated_participant(function=None, check_flow=True):
def actual_decorator(func):
@wraps(func)
def wrapper(request: HttpRequest, *args, title: str='', **kwargs) -> HttpResponse:
current_view = request.resolver_match.view_name
- 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 clean
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def clean(self):
had_values = set()
for key, value in self.data.items():
if key.startswith('SRV_'):
parts = key.split('_')
- 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 construct_change_message
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def construct_change_message(self, request, form, formsets, add=False):
"""Construct a change message from a changed object.
Copy of contrib/admin/options.py class ModelAdmin with get_text_list
replaced with self.get_field_change."""
change_message = []
- 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 participation
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def participation(request: HttpRequest, participant: models.Participant,
cat_num: int) -> HttpResponse:
cat_num = int(cat_num)
service_form = participant.form
service_form.init_counters()
- 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 send_email_to_responsibles
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def send_email_to_responsibles(self) -> None:
"""
Go through choices, activities, their categories and send email to responsibles.
:return:
- 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 getValue
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
var getValue = function($field) {
if ($field.hasClass('ays-ignore')
|| $field.hasClass('aysIgnore')
|| $field.attr('data-ays-ignore')
|| $field.attr('name') === undefined) {
Function create_email_templates
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def create_email_templates(self) -> None:
if not self.pk:
logger.error('Cannot create email template if form is not saved')
return
- 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 _fetch_instances
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _fetch_instances(self) -> None:
categories = [self.category] if self.category else self.form.sub_items
for cat1 in categories:
for cat2 in cat1.sub_items:
- 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"