TabbycatDebate/tabbycat

View on GitHub

Showing 439 of 439 total issues

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

    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

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 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 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 86..93

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/participants/models.py and 1 other location - About 50 mins to fix
tabbycat/breakqual/models.py on lines 55..62

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

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

def liveness_twoteam(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

    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

                              if cat.public:
                                  category_strs.append(escape(cat.name))
                              elif self.admin:
                                  category_strs.append("<em>" + escape(cat.name) + "</em>")
                          categories_data.append(", ".join(category_strs))
      Severity: Major
      Found in tabbycat/utils/tables.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

          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

            Avoid deeply nested control flow statements.
            Open

                                    if i == 0:
                                        cell['class'] = 'highlight-col'
                                    row.append(cell)
            Severity: Major
            Found in tabbycat/draw/tables.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if int(side.find('ballot').get('rank')) == 1:
                                          dr.add_winner(side_code)
                                  else:
              Severity: Major
              Found in tabbycat/importer/archive.py - About 45 mins to fix

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

                    duplicateAdjudicatorAllocations: (state) => {
                      let allocatedIDs = []
                      let doubleAllocatedIDs = []
                      for (let debateOrPanelID in state.debatesOrPanels) {
                        const debate = state.debatesOrPanels[debateOrPanelID]
                Severity: Minor
                Found in tabbycat/templates/allocations/DragAndDropStore.js - 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 post has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
                  Open

                      def post(self, request, *args, **kwargs):
                          t = self.tournament
                  
                          try:
                              person = Person.objects.get(url_key=kwargs['url_key'])
                  Severity: Minor
                  Found in tabbycat/checkins/views.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

                  Avoid deeply nested control flow statements.
                  Open

                                          if numeric_scores:
                                              dr.set_speaker(side_code, pos, self.speakers.get(speech.get('speaker')))
                                              if consensus:
                                                  dr.set_score(side_code, pos, float(speech.find('ballot').text))
                                              else:
                  Severity: Major
                  Found in tabbycat/importer/archive.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                if ('teams' in debate && debate.teams) {
                                  for (const keyAndEntry of Object.entries(debate.teams)) {
                                    let team = keyAndEntry[1]
                                    // Team can be a number (ID) or null (e.g. when editing sides)
                                    if (team !== null && typeof team === 'object' && 'break_categories' in team) {
                    Severity: Major
                    Found in tabbycat/templates/allocations/DragAndDropStore.js - About 45 mins to fix

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

                          def get_irons_list(self):
                              iron_speeches = []
                              use_code_names = use_team_code_names_data_entry(self.tournament, True)
                              for d in self._get_draw():
                                  for side in self.tournament.sides:
                      Severity: Minor
                      Found in tabbycat/results/views.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