TabbycatDebate/tabbycat

View on GitHub

Showing 211 of 428 total issues

Function add_adjudicator_columns has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring.
Open

    def add_adjudicator_columns(self, adjudicators, show_institutions=True,
            show_metadata=True, subtext=None):

        adj_data = []
        for adj in adjudicators:
Severity: Minor
Found in tabbycat/utils/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

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

    def _add_debate_standing_columns(self, debates, standings, itermethod, infomethod, formattext, formatsort, limit=None):
        standings_by_debate = [standings.get_standings(
                [d.get_team(side) for side in self.tournament.sides]) if not d.is_bye else None for d in debates]
        cells = []

Severity: Minor
Found in tabbycat/draw/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

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 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 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 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

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

          def get_teams(self) -> Tuple[List['Team'], List['Team']]:
              """Get teams in ranked order."""
              teams = add(*super().get_teams())
              teams = self.round.tournament.team_set.filter(id__in=[t.id for t in teams])
      
      
      Severity: Minor
      Found in tabbycat/draw/manager.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 _intermediate_brackets_1 has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
      Open

          def _intermediate_brackets_1(cls, brackets):
              """Operates in-place.
              This implements the first intermediate brackets method, where there is at most
              one intermediate bracket between brackets, but may have pullups from multiple
              brackets.
      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 populate_database has a Cognitive Complexity of 15 (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 __init__ has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
      Open

          def __init__(self, container, chair=None, panellists=None, trainees=None, from_db=False):
              """The `container` is a model instance that relates to adjudicators via
              a RelatedManager. It's easiest to think of this as a "panel", though the
              typical use case is actually a debate. The model instance's model class
              must define a property `related_adjudicator_set`, which must be the
      Severity: Minor
      Found in tabbycat/adjallocation/allocation.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