Showing 42 of 135 total issues
File test_views.py
has 593 lines of code (exceeds 250 allowed). Consider refactoring. Open
import hashlib
import json
import os
import zipfile
from io import BytesIO
- Create a ticketCreate a ticket
File tests.py
has 568 lines of code (exceeds 250 allowed). Consider refactoring. Open
from datetime import timedelta
from pathlib import Path
import django
from atom.ext.guardian.tests import PermissionStatusMixin
- Create a ticketCreate a ticket
File models.py
has 526 lines of code (exceeds 250 allowed). Consider refactoring. Open
import itertools
import logging
import re
from datetime import datetime
- Create a ticketCreate a ticket
File cbv.py
has 390 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
import json
import logging
import bleach
- Create a ticketCreate a ticket
File forms.py
has 377 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
from atom.ext.crispy_forms.forms import HelperMixin, SingleButtonMixin
from atom.ext.tinycontent.forms import GIODOMixin
from atom.forms import PartialMixin
- Create a ticketCreate a ticket
File tests.py
has 369 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
from atom.mixins import AdminTestCaseMixin
from django.core import mail
from django.test import RequestFactory
- Create a ticketCreate a ticket
Function debounce
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
function debounce(func, wait, options) {
var lastArgs,
lastThis,
maxWait,
result,
- Create a ticketCreate a ticket
File cases.py
has 297 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections import OrderedDict
from ajax_datatable import AjaxDatatableView
from atom.ext.guardian.views import RaisePermissionRequiredMixin
from braces.views import SelectRelatedMixin, UserFormKwargsMixin
- Create a ticketCreate a ticket
File common.py
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Django settings for poradnia project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
- Create a ticketCreate a ticket
Function config
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
var config = (function () {
var appName = json.name;
var path = {
npm: './node_modules/',
- Create a ticketCreate a ticket
File views.py
has 287 lines of code (exceeds 250 allowed). Consider refactoring. Open
from ajax_datatable import AjaxDatatableView
from atom.ext.crispy_forms.views import FormSetMixin
from atom.views import ActionMessageMixin, ActionView, FormInitialMixin
from braces.views import (
FormValidMessageMixin,
- Create a ticketCreate a ticket
File admin.py
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
from django import forms
from django.contrib import admin
from django.contrib.admin import helpers
from django.contrib.auth.admin import UserAdmin as AuthUserAdmin
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
- Create a ticketCreate a ticket
File views.py
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
import locale
from ajax_datatable import AjaxDatatableView
from atom.ext.guardian.views import RaisePermissionRequiredMixin
from braces.views import (
- Create a ticketCreate a ticket
File models.py
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
import logging
import re
from allauth.account.models import EmailAddress
from django.contrib.auth.models import AbstractUser, UserManager
- Create a ticketCreate a ticket
Case
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Case(models.Model):
STAFF_ORDER_DEFAULT_FIELD = "last_action"
USER_ORDER_DEFAULT_FIELD = "last_send"
STATUS = Choices(
("0", "free", _("free")),
- Create a ticketCreate a ticket
File tests.py
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
import datetime
from atom.mixins import AdminTestCaseMixin
from django.test import RequestFactory
from django.urls import reverse, reverse_lazy
- Create a ticketCreate a ticket
Function process_django_view
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def process_django_view(app, what, name, obj, options, lines):
res = get_resolver()
flat_patterns = []
def walker(flat_patterns, urlpatterns, namespace=None):
- 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
Function get_html_from_eml_file
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def get_html_from_eml_file(eml_file=None):
if eml_file is None:
logger.error("Skipping due to missing eml file.")
return ""
eml_bytes = get_bytes_from_file(eml_file)
- 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
Function get_initial_queryset
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def get_initial_queryset(self, request=None):
qs = super().get_initial_queryset(request).select_related().prefetch_related()
helped_filter = []
for helped in [("helped_yes", True), ("helped_no", False)]:
- 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
Function process_django_model
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def process_django_model(app, what, name, obj, options, lines):
# This causes import errors if left outside the function
from django.db import models
# Only look at objects that inherit from Django's base model class
- 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"