TabbycatDebate/tabbycat

View on GitHub

Showing 231 of 446 total issues

Function clean_scores_raw has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring.
Open

    def clean_scores_raw(self):
        lines = self.cleaned_data['scores_raw'].split('\n')
        errors = []
        records = []

Severity: Minor
Found in tabbycat/adjfeedback/forms.py - About 2 hrs to fix

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 allocate_debate_adjs has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring.
Open

    def allocate_debate_adjs(self, event):
        round = Round.objects.get(pk=event['extra']['round_id'])
        self._apply_allocation_settings(round, event['extra']['settings'])

        if round.draw_status == round.Status.RELEASED:
Severity: Minor
Found in tabbycat/adjallocation/consumers.py - About 2 hrs to fix

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 venue_conflicts_display has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring.
Open

def venue_conflicts_display(debates):
    """Returns a dict mapping elements (debates) in `debates` to a list of
    strings of explaining unfulfilled venue constraints for participants that
    debate. A venue constraint (or more precisely, a set of venue constraints
    relating to a single participant) is "unfulfilled" if the relevant
Severity: Minor
Found in tabbycat/venues/utils.py - About 2 hrs to fix

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 has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring.
Open

    def create(self, validated_data):
        result_data = validated_data.pop('result').pop('get_result_info')
        veto_data = validated_data.pop('debateteammotionpreference_set', None)

        validated_data.update(self.get_submitter_fields())
Severity: Minor
Found in tabbycat/api/serializers.py - About 2 hrs to fix

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 populate_from_merge has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring.
Open

    def populate_from_merge(self, *results) -> list[ResultError]:
        errors = []
        for result in results:
            errors.extend(self.merge_speaker_result(result))
            if self.scoresheet_class.uses_declared_winners:
Severity: Minor
Found in tabbycat/results/result.py - About 1 hr to fix

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_content_object_display has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring.
Open

    def get_content_object_display(self, omit_tournament=False, user=None):
        obj = self.content_object

        if obj is None:
            return None
Severity: Minor
Found in tabbycat/actionlog/models.py - About 1 hr to fix

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 handle_tournament has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring.
Open

    def handle_tournament(self, tournament, **options):

        for adj in tournament.adjudicator_set.all():
            seen = list()
            for feedback in adj.adjudicatorfeedback_set.all():
Severity: Minor
Found in tabbycat/adjfeedback/management/commands/printmultiplefeedback.py - About 1 hr to fix

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 make_feedback_form_class_for_team has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring.
Open

def make_feedback_form_class_for_team(source, tournament, submission_fields, confirm_on_submit=False,
                                      enforce_required=True, include_unreleased_draws=False,
                                      use_tournament_password=False, ignored_option=False):
    """Constructs a FeedbackForm class specific to the given source team.
    Parameters are as for make_feedback_form_class."""
Severity: Minor
Found in tabbycat/adjfeedback/forms.py - About 1 hr to fix

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 _pullup has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
Open

    def _pullup(self, brackets, indices):
        """'brackets' is what is returned by _make_raw_brackets().
        'pos' is a function taking the number of teams to choose from
        and number of teams required, and returning a list of indices
        for which teams to take as the pullup.
Severity: Minor
Found in tabbycat/draw/generator/powerpair.py - About 1 hr to fix

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_result_class has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
Open

def get_result_class(ballotsub, round=None, tournament=None):
    if round is None:
        round = ballotsub.round
    if tournament is None:
        tournament = round.tournament
Severity: Minor
Found in tabbycat/results/result.py - About 1 hr to fix

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 adjudicator_conflicts_display has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
Open

def adjudicator_conflicts_display(debates):
    """Returns a dict mapping elements (debates) in `debates` to a list of
    strings of explaining conflicts between adjudicators and teams, and
    conflicts between adjudicators and each other."""

Severity: Minor
Found in tabbycat/adjallocation/utils.py - About 1 hr to fix

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 generate has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
Open

    def generate(cls, to: 'QuerySet[Person]', round: 'Round') -> List[Tuple[EmailContextData, 'Person']]:
        emails = []
        to_ids = {p.id for p in to}
        tournament = round.tournament
        draw = round.debate_set_with_prefetches(speakers=True).filter(debateteam__team__speaker__in=to)
Severity: Minor
Found in tabbycat/notifications/utils.py - About 1 hr to fix

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 setSorting has 43 lines of code (exceeds 25 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 1 hr to fix

    Function debate_set_with_prefetches has 13 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def debate_set_with_prefetches(self, filter_args=[], filter_kwargs={}, ordering=(F('venue__name').asc(nulls_last=True),),
    Severity: Major
    Found in tabbycat/tournaments/models.py - About 1 hr to fix

      Function fill_scoresheet_randomly has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
      Open

      def fill_scoresheet_randomly(scoresheet, tournament, nattempts=1000):
          """Fills a scoresheet randomly. Operates in-place. Bails if it can't
          generate a valid scoresheet within 1000 attempts."""
          for attempt in range(nattempts):
      
      
      Severity: Minor
      Found in tabbycat/results/dbutils.py - About 1 hr to fix

      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 import_adjudicators has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
      Open

          def import_adjudicators(self, f, auto_conflict=True):
              """Imports adjudicators. Institutions are not created as needed; if an
              institution doesn't exist, an error is raised. Conflicts are created
              from the same file, if present. If 'auto_conflict' is True (default),
              conflicts are created with adjudicators' own institutions.
      Severity: Minor
      Found in tabbycat/importer/importers/anorak.py - About 1 hr to fix

      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 handle_tournament has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
      Open

          def handle_tournament(self, tournament, **options):
      
              def institution_name(inst):
                  if not inst:
                      return ""
      Severity: Minor
      Found in tabbycat/participants/management/commands/participantscsv.py - About 1 hr to fix

      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 populate_database has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
      Open

          def populate_database(self):
              """Populates the database with BreakingTeam instances for each team
              representing in `self.breaking_teams`, and those teams in
              `self.excluded_teams` that ranked ahead of the last breaking team."""
      
      
      Severity: Minor
      Found in tabbycat/breakqual/base.py - About 1 hr to fix

      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 debate_set_with_prefetches has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
      Open

          def debate_set_with_prefetches(self, filter_args=[], filter_kwargs={}, ordering=(F('venue__name').asc(nulls_last=True),),
                  teams=True, adjudicators=True, speakers=True, wins=False,
                  results=False, venues=True, institutions=False, check_ins=False, iron=False):
              """Returns the debate set, with aff_team and neg_team populated.
              This is basically a prefetch-like operation, except that it also figures
      Severity: Minor
      Found in tabbycat/tournaments/models.py - About 1 hr to fix

      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 add_feedback_progress_columns has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
      Open

          def add_feedback_progress_columns(self, progress_list, key="P"):
              def _owed_cell(progress):
                  owed = progress.num_unsubmitted()
                  cell = {
                      'text': owed,
      Severity: Minor
      Found in tabbycat/adjfeedback/tables.py - About 1 hr to fix

      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

      Severity
      Category
      Status
      Source
      Language