TabbycatDebate/tabbycat

View on GitHub

Showing 453 of 453 total issues

File emoji.py has 1720 lines of code (exceeds 600 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
import random
import logging
from typing import Tuple, Optional
 
 
Severity: Major
Found in tabbycat/participants/emoji.py - About 3 days to fix

    File serializers.py has 1246 lines of code (exceeds 600 allowed). Consider refactoring.
    Open

    from collections import OrderedDict
    from collections.abc import Mapping
    from datetime import date, datetime, time
    from functools import partial, partialmethod
     
     
    Severity: Major
    Found in tabbycat/api/serializers.py - About 2 days to fix

      File views.py has 1166 lines of code (exceeds 600 allowed). Consider refactoring.
      Open

      from copy import deepcopy
      from itertools import groupby
       
      from asgiref.sync import async_to_sync
      from channels.layers import get_channel_layer
      Severity: Major
      Found in tabbycat/api/views.py - About 1 day to fix

        Function _import has a Cognitive Complexity of 90 (exceeds 8 allowed). Consider refactoring.
        Open

        def _import(self, csvfile, model, interpreter=make_interpreter(), expect_unique=None):
        """Parses the object given in f, using the callable interpreter to parse
        each line, and passing the arguments to the given model's constructor.
        `csvfile` can be any object that is supported by csv.DictReader(), which
        includes file objects and lists of strings.
        Severity: Minor
        Found in tabbycat/importer/importers/base.py - About 1 day to fix

        Function import_results has a Cognitive Complexity of 74 (exceeds 8 allowed). Consider refactoring.
        Open

        def import_results(self):
        for round in self.root.findall('round'):
        consensus = self.preliminary_consensus if round.get('elimination') == 'false' else self.elimination_consensus
         
        for debate in round.findall('debate'):
        Severity: Minor
        Found in tabbycat/importer/archive.py - About 1 day to fix

        Function populate_results has a Cognitive Complexity of 67 (exceeds 8 allowed). Consider refactoring.
        Open

        def populate_results(ballotsubs, tournament=None):
        """Populates the `_result` attribute of each BallotSubmission in
        `ballotsubs` with a populated DebateResult instance.
         
        For best performance, the ballot submissions should already have their
        Severity: Minor
        Found in tabbycat/results/prefetch.py - About 1 day to fix

        File result.py has 862 lines of code (exceeds 600 allowed). Consider refactoring.
        Open

        """Debate result classes.
         
        Debate result classes aggregate scoresheets to produce results for an entire
        debate, and interact with the database with respect to models recording scores
        given in the debate. They do not deal with metadata (like motions), only scores
        Severity: Major
        Found in tabbycat/results/result.py - About 1 day to fix

          File tables.py has 856 lines of code (exceeds 600 allowed). Consider refactoring.
          Open

          import logging
          import warnings
           
          from django.contrib.auth.models import AnonymousUser
          from django.contrib.humanize.templatetags.humanize import ordinal
          Severity: Major
          Found in tabbycat/utils/tables.py - About 1 day to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            class EventType(models.TextChoices):
            PROCESSED = 'processed', _("Processed")
            DROPPED = 'dropped', _("Dropped")
            DEFERRED = 'deferred', _("Deferred")
            DELIVERED = 'delivered', _("Delivered")
            Severity: Major
            Found in tabbycat/notifications/models.py and 1 other location - About 7 hrs to fix
            tabbycat/notifications/models.py on lines 45..56

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            class EventType(models.TextChoices):
            POINTS = 'p', _("team points")
            BALLOTS_CONFIRMED = 'c', _("ballot confirmed")
            FEEDBACK_URL = 'f', _("feedback URL")
            BALLOT_URL = 'b', _("ballot URL")
            Severity: Major
            Found in tabbycat/notifications/models.py and 1 other location - About 7 hrs to fix
            tabbycat/notifications/models.py on lines 87..98

            Cyclomatic complexity is too high in method _import. (41)
            Open

            def _import(self, csvfile, model, interpreter=make_interpreter(), expect_unique=None):
            """Parses the object given in f, using the callable interpreter to parse
            each line, and passing the arguments to the given model's constructor.
            `csvfile` can be any object that is supported by csv.DictReader(), which
            includes file objects and lists of strings.
            Severity: Minor
            Found in tabbycat/importer/importers/base.py by radon

            Function setSorting has a Cognitive Complexity of 47 (exceeds 8 allowed). Consider refactoring.
            Open

            setSorting (state, sortType) {
            let debatesArray = Object.values(state.debatesOrPanels)
             
            if (debatesArray.length === 0) {
            return // e.g. Preformed Panels page prior to use
            Severity: Minor
            Found in tabbycat/templates/allocations/DragAndDropStore.js - About 6 hrs to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            for adj1, adj2 in combinations(debate.adjudicators.all(), 2):
             
            if conflicts.personal_conflict_adj_adj(adj1, adj2):
            conflict_messages[debate].append(("danger", _(
            "Conflict: <strong>%(adjudicator1)s</strong> & <strong>%(adjudicator2)s</strong> "
            Severity: Major
            Found in tabbycat/adjallocation/utils.py and 1 other location - About 6 hrs to fix
            tabbycat/adjallocation/utils.py on lines 25..40

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

            for adj, team in product(debate.adjudicators.all(), debate.teams):
             
            if conflicts.personal_conflict_adj_team(adj, team):
            conflict_messages[debate].append(("danger", _(
            "Conflict: <strong>%(adjudicator)s</strong> & <strong>%(team)s</strong> "
            Severity: Major
            Found in tabbycat/adjallocation/utils.py and 1 other location - About 6 hrs to fix
            tabbycat/adjallocation/utils.py on lines 43..58

            File forms.py has 792 lines of code (exceeds 600 allowed). Consider refactoring.
            Open

            import logging
            from decimal import Decimal
            from itertools import product
            from typing import TYPE_CHECKING
             
             
            Severity: Major
            Found in tabbycat/results/forms.py - About 6 hrs to fix

              Function add_debate_adjudicators_column has a Cognitive Complexity of 46 (exceeds 8 allowed). Consider refactoring.
              Open

              def add_debate_adjudicators_column(self, debates, title="Adjudicators",
              show_splits=False, highlight_adj=None, for_admin=False):
              da_data = []
               
              def construct_text(adjs_data):
              Severity: Minor
              Found in tabbycat/utils/tables.py - About 6 hrs to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              def import_rounds(self, f):
              round_interpreter_part = make_interpreter(
              tournament=self.tournament,
              stage=self.lookup_round_stage,
              draw_type=self.lookup_draw_type,
              Severity: Major
              Found in tabbycat/importer/importers/anorak.py and 1 other location - About 6 hrs to fix
              tabbycat/importer/importers/boots.py on lines 72..86

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              def import_rounds(self, f):
              interpreter_part = make_interpreter(
              tournament=self.tournament,
              stage=self.lookup_round_stage,
              draw_type=self.lookup_draw_type,
              Severity: Major
              Found in tabbycat/importer/importers/boots.py and 1 other location - About 6 hrs to fix
              tabbycat/importer/importers/anorak.py on lines 79..93

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

              def add_message(self, nsaved, ndeleted):
              if nsaved > 0:
              messages.success(self.request, ngettext(
              "Saved %(count)d adjudicator-adjudicator conflict.",
              "Saved %(count)d adjudicator-adjudicator conflicts.",
              Severity: Major
              Found in tabbycat/adjallocation/views.py and 3 other locations - About 6 hrs to fix
              tabbycat/adjallocation/views.py on lines 247..261
              tabbycat/adjallocation/views.py on lines 340..354
              tabbycat/adjallocation/views.py on lines 390..404

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

              def add_message(self, nsaved, ndeleted):
              if nsaved > 0:
              messages.success(self.request, ngettext(
              "Saved %(count)d adjudicator-institution conflict.",
              "Saved %(count)d adjudicator-institution conflicts.",
              Severity: Major
              Found in tabbycat/adjallocation/views.py and 3 other locations - About 6 hrs to fix
              tabbycat/adjallocation/views.py on lines 247..261
              tabbycat/adjallocation/views.py on lines 293..307
              tabbycat/adjallocation/views.py on lines 390..404
              Severity
              Category
              Status
              Source
              Language