Showing 45 of 197 total issues
Function get_form
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_form(self, request: HttpRequest, obj: models.ServiceForm=None, **kwargs):
form = super().get_form(request, obj, **kwargs)
if obj:
request._responsibles = responsibles = models.ResponsibilityPerson.objects.filter(
form=obj)
- 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 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 checkForm
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
var checkForm = function(evt) {
var isFieldDirty = function($field) {
var origValue = $field.data('ays-orig');
if (undefined === origValue) {
Function serviceform
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def serviceform(function=None, check_form_permission=False, init_counters=False,
all_responsibles=True, fetch_participants=False):
def actual_decorator(func):
@wraps(func)
def wrapper(request: HttpRequest, slug: str,
- 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 participant_flow_menu_items
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def participant_flow_menu_items(context: Context) -> List[FlowItem]:
current_view = context['request'].resolver_match.view_name
participant = context['request'].participant
cat_num = context.get('cat_num', 0)
lst = []
- 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 can_access_view
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def can_access_view(self, view_name: str, auth: bool=False) -> bool:
"""
Access is granted to next view after last finished view
auth: if query is for authentication (if we can already really proceed to view or not).
- 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 get_field_change
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_field_change(self, form, changed_fields):
"""Mentions old and new value for changed fields"""
changes = []
for field_name in changed_fields:
field = form.fields[field_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 contact_details
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def contact_details(request: HttpRequest, participant: models.Participant) -> HttpResponse:
if participant and participant.status == models.Participant.STATUS_FINISHED:
return HttpResponseRedirect(reverse('submitted'))
form = forms.ContactForm(instance=participant, user=request.user)
- 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 invite_user
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def invite_user(self, email: str, old_participants: bool=False) -> InviteUserResponse:
"""
Create new participations to current form version and send invites
:return: int (one of InviteUserResponse constants)
- 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 deeply nested control flow statements. Open
if not choice.skip_numbering:
choice_counter += 1
choice._counter = choice_counter
Avoid deeply nested control flow statements. Open
if all_responsibles:
choice._responsibles.update(set(activity.responsibles.all()) |
set(cat1.responsibles.all()) |
set(cat2.responsibles.all()))
Function save_related
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def save_related(self, request: HttpRequest, form, formsets, change: bool):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, participant: models.Participant, user: 'AbstractUser',
Function serviceform
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def serviceform(function=None, check_form_permission=False, init_counters=False,
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, request: HttpRequest, participant: models.Participant,
Function make
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def make(cls, method: Callable, *args, scheduled_time: 'datetime'=None, **kwargs):
Function save_model
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def save_model(self, request: HttpRequest, obj: models.ServiceForm, form, change: bool):
Function make
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def make(cls, name: str, form: 'ServiceForm', content: str, subject: str):
Function view_participant
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def view_participant(request: HttpRequest, responsible: models.ResponsibilityPerson,
participant_id: int) -> HttpResponse:
participant = get_object_or_404(models.Participant.objects, pk=participant_id)
anonymous = False
is_staff = False
- 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 _get_ident
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _get_ident(request: HttpRequest) -> str:
service_form = getattr(request, 'service_form', '')
if not service_form:
logger.error('No serviceform in _get_ident!?')
- 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"