Showing 19 of 28 total issues
File report_delivery.py
has 402 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
import logging
import os
from collections import OrderedDict
from io import BytesIO
File api.py
has 361 lines of code (exceeds 250 allowed). Consider refactoring. Open
import copy
import logging
import os
import typing
CallistoCoreNotificationApi
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
class CallistoCoreNotificationApi(object):
report_filename = "callisto_record_{0}.pdf.gpg"
report_title = "Callisto Record"
logo_path = "../../assets/callisto_logo.png"
File view_partials.py
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
View partials provide all the callisto-core front-end functionality.
Subclass these partials with your own views if you are implementing
callisto-core. Many of the view partials only provide a subset of the
StepsHelper
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class StepsHelper(object):
done_name = "done"
review_name = "Review"
next_name = "Next"
back_name = "Back"
Function clean
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def clean(self):
identifiers = set()
identifier_type = ""
identifier_types = validators.perp_identifiers()
from django.core.exceptions import ValidationError
- 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 set_up_styles
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_up_styles(self, *args, **kwargs):
"""
Helper formatting methods assume the following styles have been defined:
* Normal: format_question, get_metadata_page
* Notes: get_metadata_page
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Function facebook_validation_function
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def facebook_validation_function(url):
try:
url_parts = _get_url_parts(url)
# check if acceptable domain
domain = url_parts[1]
- 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_report_to_authority
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_report_to_authority(
Function slack_notification
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def slack_notification(
Function dispatch
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def dispatch(self, request, token=None, uidb64=None, *args, **kwargs):
Function send_user_review_nofication
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_user_review_nofication(
Function on_retry
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def on_retry(self, exc, task_id, args, kwargs, einfo):
Function on_failure
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def on_failure(self, exc, task_id, args, kwargs, einfo):
Function twitter_validation_function
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def twitter_validation_function(value):
path = None
try:
url_parts = _get_url_parts(value)
# check if acceptable domain
- 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 authenticate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def authenticate(self, request, username, password):
username = sha256(username.encode("utf-8")).hexdigest()
username_index = index(username)
for user in Account.objects.filter(username_index=username_index):
if not user or not bcrypt.checkpw(
- 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 _passphrase_next_url
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _passphrase_next_url(self, request):
next_url = None
if "next" in request.GET:
if re.search(r"^/[\W/-]*", request.GET["next"]):
if is_safe_url(request.GET["next"]):
- 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 dispatch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def dispatch(self, request, *args, **kwargs):
logger.debug(f"{self.__class__.__name__} access check")
if (
self.access_granted or self.access_form_valid
- 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"