uktrade/directory-sso

View on GitHub

Showing 337 of 337 total issues

Function cookie has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

GOVUK.cookie = (new function() {

  /* Set a cookie.
   * @name (String) Name of cookie
   * @value (String) Value to store
Severity: Minor
Found in static/javascripts/index.js - About 1 hr to fix

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

            migrations.AlterField(
                model_name='userprofile',
                name='user',
                field=models.OneToOneField(
                    on_delete=django.db.models.deletion.CASCADE, related_name='user_profile', to=settings.AUTH_USER_MODEL
    Severity: Major
    Found in sso/user/migrations/0011_auto_20191107_1240.py and 1 other location - About 1 hr to fix
    sso/verification/migrations/0002_auto_20190514_1520.py on lines 16..23

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

    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

        operations = [
            migrations.AlterField(
                model_name='verificationcode',
                name='user',
                field=models.OneToOneField(
    Severity: Major
    Found in sso/verification/migrations/0002_auto_20190514_1520.py and 1 other location - About 1 hr to fix
    sso/user/migrations/0011_auto_20191107_1240.py on lines 27..31

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

    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 handle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def handle(self, *args, **options):
            queryset = User.inactive
    
            today = datetime.now()
    
    
    Severity: Minor
    Found in sso/management/commands/notify_users.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 send_mail has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def send_mail(self, template_prefix, email, context):
            # Don't send an email if the account doesn't exist
            if template_prefix == 'account/email/unknown_account':
                return None
    
    
    Severity: Minor
    Found in sso/adapters.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

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

            migrations.AlterField(
                model_name='question',
                name='question_choices',
                field=django.contrib.postgres.fields.jsonb.JSONField(
    Severity: Minor
    Found in sso/user/migrations/0023_auto_20210412_1614.py and 1 other location - About 55 mins to fix
    sso/user/migrations/0013_auto_20191128_1308.py on lines 13..17

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

    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 is_valid_domain has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def is_valid_domain(domain):
        # NOTE: tldextract and urlparse both have their shortcomings so
        # using both for what they do good
        # add local domain suffix because it is non-standard
        extract_with_extra_suffix = tldextract.TLDExtract(
    Severity: Minor
    Found in core/helpers.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

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

        operations = [
            migrations.AlterField(
                model_name='user',
                name='utm',
                field=django.contrib.postgres.fields.jsonb.JSONField(
    Severity: Minor
    Found in sso/user/migrations/0013_auto_20191128_1308.py and 1 other location - About 55 mins to fix
    sso/user/migrations/0023_auto_20210412_1614.py on lines 24..27

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

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

    def inject_data(user, user_data_name, items):
        data_object = UserData.objects.filter(user=user, name=user_data_name).first()
        data_object = data_object or UserData(user=user, name=user_data_name)
    
        if not data_object.data:
    Severity: Minor
    Found in sso/user/management/commands/move_ep_to_basket.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

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

            response['Content-Disposition'] = 'attachment; filename="{prefix}_{timestamp}.csv"'.format(
                prefix=filename_prefix, timestamp=datetime.datetime.now().strftime("%Y%m%d%H%M%S")
    Severity: Minor
    Found in sso/user/admin.py and 1 other location - About 40 mins to fix
    sso/user/admin.py on lines 125..126

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

    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

            response['Content-Disposition'] = 'attachment; filename="{prefix}_{timestamp}.csv"'.format(
                prefix=filename_prefix, timestamp=datetime.datetime.now().strftime("%Y%m%d%H%M%S")
    Severity: Minor
    Found in sso/user/admin.py and 1 other location - About 40 mins to fix
    sso/user/admin.py on lines 82..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 34.

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

    def set_lesson_completed(user, service_name, lesson_name, lesson, module):
    Severity: Minor
    Found in sso/user/utils.py - About 35 mins to fix

      Function process_view has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def process_view(self, request, view_func, view_args, view_kwarg):
              # Django admin users without permission will be displayed custom message to request access
              if request.user.is_authenticated:
                  if self.is_admin_name_space(request) or request.path_info.startswith('/admin/login'):
                      if not request.user.is_staff:
      Severity: Minor
      Found in core/middleware.py - About 35 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 get_social_account_image has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_social_account_image(account):
          if account.provider == 'linkedin_oauth2':
              for size_variant in account.extra_data.get('profilePicture', {}).get('displayImage~', {}).get('elements', {}):
                  for image in size_variant['identifiers']:
                      return image['identifier']
      Severity: Minor
      Found in sso/user/utils.py - About 35 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

              migrations.AddField(
                  model_name='user',
                  name='modified',
                  field=django_extensions.db.fields.ModificationDateTimeField(
      Severity: Minor
      Found in sso/user/migrations/0002_auto_20161130_1135.py and 1 other location - About 35 mins to fix
      sso/user/migrations/0002_auto_20161130_1135.py on lines 16..19

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

      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

              migrations.AddField(
                  model_name='user',
                  name='created',
                  field=django_extensions.db.fields.CreationDateTimeField(
      Severity: Minor
      Found in sso/user/migrations/0002_auto_20161130_1135.py and 1 other location - About 35 mins to fix
      sso/user/migrations/0002_auto_20161130_1135.py on lines 23..26

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

      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 11 locations. Consider refactoring.
      Open

              migrations.AlterField(
                  model_name='userpageview',
                  name='id',
                  field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 13..16
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 18..21
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 23..26
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 33..36
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 38..41
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 43..46
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 60..63
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 70..73
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 80..83
      sso/verification/migrations/0003_alter_verificationcode_id.py on lines 12..16

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

      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 11 locations. Consider refactoring.
      Open

              migrations.AlterField(
                  model_name='question',
                  name='id',
                  field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 13..16
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 18..21
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 33..36
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 38..41
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 43..46
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 60..63
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 70..73
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 75..78
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 80..83
      sso/verification/migrations/0003_alter_verificationcode_id.py on lines 12..16

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

      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 11 locations. Consider refactoring.
      Open

              migrations.AlterField(
                  model_name='servicepage',
                  name='id',
                  field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 13..16
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 18..21
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 23..26
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 33..36
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 43..46
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 60..63
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 70..73
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 75..78
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 80..83
      sso/verification/migrations/0003_alter_verificationcode_id.py on lines 12..16

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

      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 11 locations. Consider refactoring.
      Open

              migrations.AlterField(
                  model_name='userdata',
                  name='id',
                  field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'),
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 13..16
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 18..21
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 23..26
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 33..36
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 38..41
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 43..46
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 60..63
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 75..78
      sso/user/migrations/0028_alter_dataretentionstatistics_id_and_more.py on lines 80..83
      sso/verification/migrations/0003_alter_verificationcode_id.py on lines 12..16

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

      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