TabbycatDebate/tabbycat

View on GitHub

Showing 2,292 of 2,292 total issues

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

  if (!django.jsi18n_initialized) {
    django.gettext = function(msgid) {
      var value = django.catalog[msgid];
      if (typeof(value) == 'undefined') {
        return msgid;
Severity: Major
Found in tabbycat/locale/jsi18n/ar/djangojs.js and 1 other location - About 4 days to fix
tabbycat/locale/jsi18n/ja/djangojs.js on lines 89..203

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

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 (!django.jsi18n_initialized) {
    django.gettext = function(msgid) {
      var value = django.catalog[msgid];
      if (typeof(value) == 'undefined') {
        return msgid;
Severity: Major
Found in tabbycat/locale/jsi18n/ja/djangojs.js and 1 other location - About 4 days to fix
tabbycat/locale/jsi18n/ar/djangojs.js on lines 109..223

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

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 (!django.jsi18n_initialized) {
    django.gettext = function(msgid) {
      var value = django.catalog[msgid];
      if (typeof(value) == 'undefined') {
        return msgid;
Severity: Major
Found in tabbycat/locale/jsi18n/en/djangojs.js and 1 other location - About 4 days to fix
tabbycat/locale/jsi18n/pt/djangojs.js on lines 89..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 748.

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 (!django.jsi18n_initialized) {
    django.gettext = function(msgid) {
      var value = django.catalog[msgid];
      if (typeof(value) == 'undefined') {
        return msgid;
Severity: Major
Found in tabbycat/locale/jsi18n/pt/djangojs.js and 1 other location - About 4 days to fix
tabbycat/locale/jsi18n/en/djangojs.js on lines 16..122

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

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

File emoji.py has 1465 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
import random
import logging

logger = logging.getLogger(__name__)
Severity: Major
Found in tabbycat/participants/emoji.py - About 3 days to fix

    File preferences.py has 1154 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from django.core.validators import MinValueValidator, validate_slug
    from django.forms import ValidationError
    from django.utils.encoding import force_text
    from django.utils.translation import gettext_lazy as _
    from django_summernote.widgets import SummernoteWidget
    Severity: Major
    Found in tabbycat/options/preferences.py - About 2 days to fix

      File tables.py has 835 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import logging
      import warnings
      
      from django.utils import formats
      from django.utils.encoding import force_text
      Severity: Major
      Found in tabbycat/utils/tables.py - About 2 days to fix

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

            def _result_cell_class_two(self, win, cell):
                team_name = cell['popover']['title']
                if win is True:
                    cell['popover']['title'] = _("%(team)s won") % {'team': team_name}
                    cell['icon'] = "chevron-up"
        Severity: Major
        Found in tabbycat/utils/tables.py and 1 other location - About 1 day to fix
        tabbycat/utils/tables.py on lines 328..344

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

        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 _result_cell_class_four_elim(self, advancing, cell):
                team_name = cell['popover']['title']
                if advancing is True:
                    cell['popover']['title'] = _("%(team)s is advancing") % {'team': team_name}
                    cell['icon'] = "chevron-up"
        Severity: Major
        Found in tabbycat/utils/tables.py and 1 other location - About 1 day to fix
        tabbycat/utils/tables.py on lines 282..298

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

        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

        File views.py has 776 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import json
        import datetime
        import logging
        import unicodedata
        from itertools import product
        Severity: Major
        Found in tabbycat/draw/views.py - About 1 day to fix

          Function _import has a Cognitive Complexity of 90 (exceeds 5 allowed). Consider refactoring.
          Open

              def _import(self, csvfile, model, interpreter=make_interpreter(), expect_unique=None):
                  """Parses the object given in f, using the callable interpreter to parse
                  each line, and passing the arguments to the given model's constructor.
                  `csvfile` can be any object that is supported by csv.DictReader(), which
                  includes file objects and lists of strings.
          Severity: Minor
          Found in tabbycat/importer/importers/base.py - About 1 day 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

          File views.py has 679 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import json
          import logging
          import math
          import csv
          
          
          Severity: Major
          Found in tabbycat/adjfeedback/views.py - About 1 day to fix

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

              var newcatalog = {
                "%(sel)s of %(cnt)s selected": [
                  "%(sel)s sur %(cnt)s s\u00e9lectionn\u00e9",
                  "%(sel)s sur %(cnt)s s\u00e9lectionn\u00e9s"
                ],
            Severity: Major
            Found in tabbycat/locale/jsi18n/fr/djangojs.js and 1 other location - About 1 day to fix
            tabbycat/locale/jsi18n/pt/djangojs.js on lines 22..83

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

            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

              var newcatalog = {
                "%(sel)s of %(cnt)s selected": [
                  "%(sel)s de %(cnt)s selecionado",
                  "%(sel)s de %(cnt)s selecionados"
                ],
            Severity: Major
            Found in tabbycat/locale/jsi18n/pt/djangojs.js and 1 other location - About 1 day to fix
            tabbycat/locale/jsi18n/fr/djangojs.js on lines 22..83

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

            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

            File result.py has 638 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            """Debate result classes.
            
            Debate result classes aggregate scoresheets to produce results for an entire
            debate, and interact with the database with respect to models recording scores
            given in the debate. They do not deal with metadata (like motions), only scores
            Severity: Major
            Found in tabbycat/results/result.py - About 1 day to fix

              File forms.py has 609 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import logging
              from itertools import product
              
              from asgiref.sync import async_to_sync
              from channels.layers import get_channel_layer
              Severity: Major
              Found in tabbycat/results/forms.py - About 1 day to fix

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

                    def post(self, request, *args, **kwargs):
                        body = self.request.body.decode('utf-8')
                        posted_info = json.loads(body)
                
                        try:
                Severity: Major
                Found in tabbycat/participants/views.py and 1 other location - About 1 day to fix
                tabbycat/breakqual/views.py on lines 292..307

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

                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 post(self, request, *args, **kwargs):
                        body = self.request.body.decode('utf-8')
                        posted_info = json.loads(body)
                
                        try:
                Severity: Major
                Found in tabbycat/breakqual/views.py and 1 other location - About 1 day to fix
                tabbycat/participants/views.py on lines 389..404

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

                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

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

                    def handle(self, *args, **options):
                        if not self.get_rounds(options) and not options["debates"]:
                            raise CommandError("No rounds or debates were given. (Use --help for more info.)")
                
                        super(Command, self).handle(*args, **options)  # Handles rounds
                Severity: Major
                Found in tabbycat/adjfeedback/management/commands/generatefeedback.py and 1 other location - About 1 day to fix
                tabbycat/results/management/commands/generateresults.py on lines 88..102

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

                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

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

                    def handle(self, *args, **options):
                        if not self.get_rounds(options) and not options["debates"]:
                            raise CommandError("No rounds or debates were given. (Use --help for more info.)")
                
                        super(Command, self).handle(*args, **options)  # Handles rounds
                Severity: Major
                Found in tabbycat/results/management/commands/generateresults.py and 1 other location - About 1 day to fix
                tabbycat/adjfeedback/management/commands/generatefeedback.py on lines 74..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 148.

                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

                Severity
                Category
                Status
                Source
                Language