Showing 137 of 185 total issues
File utils.py
has 373 lines of code (exceeds 250 allowed). Consider refactoring. Open
from django.core.paginator import PageNotAnInteger, EmptyPage
from django.apps import apps
from django.http import HttpResponse, Http404, JsonResponse
from typing import Callable
File models.py
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
import requests
import json
from django.utils.translation import gettext_lazy as _
# from boogie import models
File views.py
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
from logging import getLogger
from django.db import transaction
from django.db.models import F
from django.http import HttpResponse, HttpResponseServerError, JsonResponse
File cluster_queryset.py
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
from logging import getLogger
from boogie.models import QuerySet, F, Manager, Value, IntegerField
from django.contrib.auth import get_user_model
from sidekick import import_later
File conversation.py
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
from autoslug import AutoSlugField
from boogie import models
from boogie import rules
from django.conf import settings
from django.contrib.auth import get_user_model
Function AreaChart
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function AreaChart(voteData, color) {
const curve = d3.curveLinear;
const margin = { top: 20, right: 30, bottom: 30, left: 40 };
let width = d3.select("#votes-over-time").attr("width");
Function clean_migrations
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def clean_migrations(_ctx, all=False, yes=False):
"""
Remove all automatically created migrations.
"""
import re
- 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 constructor
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor({size, intersections, radius = 50, pos = null, vel = null, isUserGroup = false, name = "Group"}) {
this.size = size;
this.intersections = intersections.slice();
this.radius = radius;
this.mass = (this.radius / 100) ** 2;
Function summarize_affinities
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def summarize_affinities(affinities):
"""
Process the result of :func:`compute_cluster_affinities`
and returns a list of summaries for each cluster/intersection. This data
is exposed in the /api/v1/clusterizations/<id>/affinities/ as:
- 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 stereotype_votes
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def stereotype_votes(request, conversation_id, **kwargs):
conversation = Conversation.objects.get(id=conversation_id)
clusterization = conversation.get_clusterization(default=None)
created_vote_id = None
if clusterization is None:
- 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 main
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def main():
"""
This code was taken and adapted from
django.core.management.commands.compilemessages
- 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 with_template
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def with_template(model, role, template=None, queryset=False):
"""
Decorator Register element rendered from a template.
Args:
- 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 _draw
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
_draw: function() {
var o = this.data('pagination'),
interval = methods._getInterval(o),
i;
Function mautic
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def mautic(request, board_slug, conversation_id, slug, oauth2_code=None):
conversation = Conversation.objects.get(id=conversation_id)
user_signature = SignatureFactory.get_user_signature(conversation.author)
tool = user_signature.get_tool(_("Mautic"), conversation)
tool.raise_error_if_not_active()
- 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_clusters_from_comments
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def set_clusters_from_comments(conversation, comment_map, exclusive=True, author=None):
"""
Create clusters and stereotypes from conversation.
Usage:
- 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 statistics_summary_dataframe
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def statistics_summary_dataframe(
self,
normalization=1,
votes=None,
comments=None,
- 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 _stereotypes_votes_table
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _stereotypes_votes_table(self, mean, kind_col, cluster_col, **kwargs):
# Prepare stereotype votes
if mean:
stereotype_votes = self.mean_stereotypes_votes_table()
else:
- 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 watch_path
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def watch_path(path, func, poll_time=0.5, name=None, skip_first=False):
"""
Watch path and execute the given function everytime a file changes.
"""
import time
- 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 cluster_votes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def cluster_votes(conversation, users):
clusterization = conversation.get_clusterization()
comments = list(conversation.comments.all())
comments_map = {comment.id: comment for comment in comments}
clusters = {cluster: [] for cluster in clusterization.clusters.all()}
- 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 update_clusterization
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def update_clusterization(self, force=False, atomic=False):
"""
Update clusters if necessary, unless force=True, in which it
unconditionally updates the clusterization.
"""
- 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"