TabbycatDebate/tabbycat

View on GitHub

Showing 446 of 446 total issues

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

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        if not is_staff(kwargs.get('context')):
            t = kwargs['context']['tournament']
            with_permission = partial(has_permission, user=kwargs['context']['request'].user, tournament=t)
Severity: Minor
Found in tabbycat/api/serializers.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

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

            for team_name in line['team_conflicts'].split(","):
                team_name = team_name.strip()
                team = pm.Team.objects.lookup(team_name)
                yield {
                    'adjudicator' : adjudicator,
Severity: Minor
Found in tabbycat/importer/importers/anorak.py and 1 other location - About 45 mins to fix
tabbycat/importer/importers/anorak.py on lines 278..283

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

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

    def _warning(self, message):
        if self.verbosity > 0:
            if self.color:
                message = "\033[0;33mWarning: " + message + "\033[0m\n"
            self.stdout.write(message)
Severity: Minor
Found in tabbycat/importer/management/commands/importtournament.py and 1 other location - About 45 mins to fix
tabbycat/importer/management/commands/importtournament.py on lines 104..108

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

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 institution_name in line['institution_conflicts'].split(","):
                institution_name = institution_name.strip()
                institution = pm.Institution.objects.lookup(institution_name)
                yield {
                    'adjudicator' : adjudicator,
Severity: Minor
Found in tabbycat/importer/importers/anorak.py and 1 other location - About 45 mins to fix
tabbycat/importer/importers/anorak.py on lines 291..296

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

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

    def _print_stage(self, message):
        if self.verbosity > 0:
            if self.color:
                message = "\033[0;36m" + message + "\033[0m\n"
            self.stdout.write(message)
Severity: Minor
Found in tabbycat/importer/management/commands/importtournament.py and 1 other location - About 45 mins to fix
tabbycat/importer/management/commands/importtournament.py on lines 125..129

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

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

Consider simplifying this complex logical expression.
Open

    if feedback_paths == 'no-adjs':
        targets = []
    elif feedback_paths == 'all-adjs' or debateadj.type == DebateAdjudicator.TYPE_CHAIR:
        targets = [(adj, pos) for adj, pos in adjudicators.with_positions() if adj.id != debateadj.adjudicator_id]
    elif feedback_paths == 'with-p-on-p' and debateadj.type == DebateAdjudicator.TYPE_PANEL:
Severity: Major
Found in tabbycat/adjfeedback/utils.py - About 40 mins to fix

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

        def get_queryset(self, request):
            return super(TeamScoreByAdjAdmin, self).get_queryset(request).select_related(
                'ballot_submission__debate__round__tournament',
                'debate_adjudicator__adjudicator',
                'debate_team__team',
    Severity: Minor
    Found in tabbycat/results/admin.py and 1 other location - About 40 mins to fix
    tabbycat/results/admin.py on lines 107..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 52.

    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

        def get_queryset(self, request):
            return super(SpeakerScoreAdmin, self).get_queryset(request).select_related(
                'debate_team__debate__round',
                'debate_team__team__institution', 'debate_team__team__tournament',
                'ballot_submission').prefetch_related(
    Severity: Minor
    Found in tabbycat/results/admin.py and 1 other location - About 40 mins to fix
    tabbycat/results/admin.py on lines 82..89

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

    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_team_ballots has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def add_team_ballots(self, side_tag, result, adj, scoresheet, side):
    Severity: Minor
    Found in tabbycat/importer/archive.py - About 35 mins to fix

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

          def __init__(self, ballotsub, tabroom, password=False, *args, **kwargs):
      Severity: Minor
      Found in tabbycat/results/forms.py - About 35 mins to fix

        Function set_criterion_score has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def set_criterion_score(self, adj, side, pos, criterion, score):
        Severity: Minor
        Found in tabbycat/results/result.py - About 35 mins to fix

          Function build has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def build(self, draw, teams, side_histories_before, side_histories_now, standings):
          Severity: Minor
          Found in tabbycat/draw/tables.py - About 35 mins to fix

            Function receive_debate_change has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def receive_debate_change(self, content, key, content_name, field_name, serializer):
            Severity: Minor
            Found in tabbycat/draw/consumers.py - About 35 mins to fix

              Function build has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def build(self, debates, teams, side_histories_before, side_histories_now, standings):
              Severity: Minor
              Found in tabbycat/draw/tables.py - About 35 mins to fix

                Function add_debate_adjudicators_column has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def add_debate_adjudicators_column(self, debates, title="Adjudicators",
                Severity: Minor
                Found in tabbycat/utils/tables.py - About 35 mins to fix

                  Function liveness has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def liveness(self, team, teams_count, prelims, current_round):
                  Severity: Minor
                  Found in tabbycat/breakqual/utils.py - About 35 mins to fix

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

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

                      Function construct_info has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def construct_info(self, venue, source, source_p, target, target_p):
                      Severity: Minor
                      Found in tabbycat/printing/views.py - About 35 mins to fix

                        Function get_response_dict has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def get_response_dict(self, request, obj, checked, event, **kwargs):
                        Severity: Minor
                        Found in tabbycat/api/views.py - About 35 mins to fix

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

                              def __init__(self, container, chair=None, panellists=None, trainees=None, from_db=False):
                          Severity: Minor
                          Found in tabbycat/adjallocation/allocation.py - About 35 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language