TabbycatDebate/tabbycat

View on GitHub

Showing 446 of 446 total issues

Function handle_tournament has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
Open

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

        def institution_name(inst):
            if options['full_institution_name']:
                return inst.name
Severity: Minor
Found in tabbycat/adjallocation/management/commands/conflictscsv.py - About 55 mins 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

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

        if http_prefix:
            # If needed, convert absolute URLs to relative path
            data = parse.urlparse(data).path
            prefix = get_script_prefix()
            if data.startswith(prefix):
Severity: Minor
Found in tabbycat/api/fields.py and 1 other location - About 55 mins to fix
tabbycat/api/fields.py on lines 190..195

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        if ntoolarge > 0:
            warning_msg = ngettext(
                "%(count)s score is larger than the maximum permitted adjudicator score (%(score).1f).",
                "%(count)s scores are larger than the maximum permitted adjudicator score (%(score).1f).",
                ntoolarge,
Severity: Minor
Found in tabbycat/adjallocation/allocators/hungarian.py and 1 other location - About 55 mins to fix
tabbycat/adjallocation/allocators/hungarian.py on lines 57..64

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        if ntoosmall > 0:
            warning_msg = ngettext(
                "%(count)s score is smaller than the minimum permitted adjudicator score (%(score).1f).",
                "%(count)s scores are smaller than the minimum permitted adjudicator score (%(score).1f).",
                ntoosmall,
Severity: Minor
Found in tabbycat/adjallocation/allocators/hungarian.py and 1 other location - About 55 mins to fix
tabbycat/adjallocation/allocators/hungarian.py on lines 48..55

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 55.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function _add_debate_standing_columns has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def _add_debate_standing_columns(self, debates, standings, itermethod, infomethod, formattext, formatsort, limit=None):
Severity: Major
Found in tabbycat/draw/tables.py - About 50 mins to fix

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

        class Meta:
            constraints = [
                UniqueConstraint(fields=['tournament', 'seq']),
                UniqueConstraint(fields=['tournament', 'slug']),
            ]
    Severity: Minor
    Found in tabbycat/participants/models.py and 1 other location - About 50 mins to fix
    tabbycat/breakqual/models.py on lines 57..64

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

        for team in teams:
            progress = FeedbackProgressForTeam(team)
            progress._submitted_feedback = submitted_feedback_by_team_id[team.id]
            progress._debateteams = debateteams_by_team_id[team.id]
            teams_progress.append(progress)
    Severity: Minor
    Found in tabbycat/adjfeedback/progress.py and 1 other location - About 50 mins to fix
    tabbycat/adjfeedback/progress.py on lines 423..427

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

    class DebateIdentifier(Identifier):
    
        instance_attr = 'debate'
    
        debate = models.OneToOneField('draw.Debate', models.CASCADE,
    Severity: Minor
    Found in tabbycat/checkins/models.py and 1 other location - About 50 mins to fix
    tabbycat/checkins/models.py on lines 47..56

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

    class PersonIdentifier(Identifier):
    
        instance_attr = 'person'
    
        person = models.OneToOneField('participants.Person', models.CASCADE,
    Severity: Minor
    Found in tabbycat/checkins/models.py and 1 other location - About 50 mins to fix
    tabbycat/checkins/models.py on lines 59..68

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

        class Meta:
            constraints = [
                UniqueConstraint(fields=['tournament', 'seq']),
                UniqueConstraint(fields=['tournament', 'slug']),
            ]
    Severity: Minor
    Found in tabbycat/breakqual/models.py and 1 other location - About 50 mins to fix
    tabbycat/participants/models.py on lines 106..113

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

        for adj in adjudicators:
            progress = FeedbackProgressForAdjudicator(adj)
            progress._submitted_feedback = submitted_feedback_by_adj_id[adj.id]
            progress._debateadjudicators = debateadjs_by_adj_id[adj.id]
            adjs_progress.append(progress)
    Severity: Minor
    Found in tabbycat/adjfeedback/progress.py and 1 other location - About 50 mins to fix
    tabbycat/adjfeedback/progress.py on lines 402..406

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 54.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function process_view has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
    Open

        def process_view(self, request, view_func, view_args, view_kwargs):
            if 'tournament_slug' in view_kwargs and request.path.split('/')[1] != 'api':
                cached_key = "%s_%s" % (view_kwargs['tournament_slug'], 'object')
                cached_tournament_object = cache.get(cached_key)
    
    
    Severity: Minor
    Found in tabbycat/utils/middleware.py - About 45 mins 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 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, teams, bracket, room_rank, flags=[], team_flags={}, winner=None):
    Severity: Minor
    Found in tabbycat/draw/generator/pairing.py - About 45 mins to fix

      Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, teams, bracket, room_rank, num_sides=4, flags=[], team_flags={}):
      Severity: Minor
      Found in tabbycat/draw/generator/pairing.py - About 45 mins to fix

        Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, teams, bracket, room_rank, flags=[], team_flags={}, advancing=[]):
        Severity: Minor
        Found in tabbycat/draw/generator/pairing.py - About 45 mins to fix

          Function _define_rooms_anywhere has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
          Open

              def _define_rooms_anywhere(points):
                  """Defines rooms so that pull-up teams can go anywhere in the next
                  bracket up."""
                  counts = Counter(points)
                  rooms = []
          Severity: Minor
          Found in tabbycat/draw/generator/bphungarian.py - About 45 mins 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_speakers has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
          Open

              def add_speakers(self, side_tag, debate, result, side):
                  for pos in self.t.positions:
                      speaker = result.get_speaker(side, pos)
          
                      if speaker is not None:
          Severity: Minor
          Found in tabbycat/importer/archive.py - About 45 mins 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 liveness_bp has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def liveness_bp(is_general, current_round, break_size, total_teams, total_rounds, team_scores=[]):
          Severity: Minor
          Found in tabbycat/breakqual/liveness.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    for ballot in side.findall('ballot'):
                                        for adj in [self.adjudicators.get(a) for a in ballot.get('adjudicators', "").split(" ")]:
                                            if int(ballot.get('rank')) == 1:
                                                dr.add_winner(adj, side_code)
                            dr.save()
            Severity: Major
            Found in tabbycat/importer/archive.py - About 45 mins to fix

              Function import_venues has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
              Open

                  def import_venues(self, f, auto_create_categories=True):
                      interpreter = make_interpreter(tournament=self.tournament,
                          DELETE=['category', lambda x: x.startswith('available:')])
              
                      venues = self._import(f, vm.Venue, interpreter)
              Severity: Minor
              Found in tabbycat/importer/importers/boots.py - About 45 mins 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