bothub-it/bothub-engine

View on GitHub

Showing 270 of 270 total issues

File models.py has 2260 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from typing import Tuple
import uuid
from functools import reduce

import requests
Severity: Major
Found in bothub/common/models.py - About 6 days to fix

    File serializers.py has 1514 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from bothub.common.documents.repositoryqanlplog import RepositoryQANLPLogDocument
    from django.conf import settings
    from django.shortcuts import get_object_or_404
    from django.utils.translation import ugettext_lazy as _
    from rest_framework import serializers
    Severity: Major
    Found in bothub/api/v2/repository/serializers.py - About 4 days to fix

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

      import json
      import uuid
      
      from django.conf import settings
      from django.contrib.auth import get_user_model
      Severity: Major
      Found in bothub/api/v2/repository/views.py - About 3 days to fix

        File tests.py has 1355 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import requests_mock
        from django.conf import settings
        from django.core.exceptions import ValidationError
        from django.test import TestCase
        from django.utils import timezone
        Severity: Major
        Found in bothub/common/tests.py - About 3 days to fix

          File 0040_initial.py has 1072 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # Generated by Django 2.1.11 on 2019-12-09 19:22
          
          import bothub.common.languages
          import bothub.common.models
          from django.conf import settings
          Severity: Major
          Found in bothub/common/migrations/0040_initial.py - About 2 days to fix

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

            import base64
            
            from django.conf import settings
            from django.core.exceptions import ValidationError
            from django.core.validators import URLValidator
            Severity: Major
            Found in bothub/api/v2/nlp/views.py - About 1 day to fix

              File tasks.py has 588 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import json
              import random
              import requests
              from datetime import timedelta
              from urllib.parse import urlencode
              Severity: Major
              Found in bothub/common/tasks.py - About 1 day to fix

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

                        migrations.CreateModel(
                            name="RepositoryExampleEntity",
                            fields=[
                                (
                                    "id",
                Severity: Major
                Found in bothub/common/migrations/0040_initial.py and 1 other location - About 1 day to fix
                bothub/common/migrations/0040_initial.py on lines 684..735

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

                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.CreateModel(
                            name="RepositoryTranslatedExampleEntity",
                            fields=[
                                (
                                    "id",
                Severity: Major
                Found in bothub/common/migrations/0040_initial.py and 1 other location - About 1 day to fix
                bothub/common/migrations/0040_initial.py on lines 584..635

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

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

                Severity: Major
                Found in bothub/common/migrations/0077_auto_20200807_1410.py and 2 other locations - About 1 day to fix
                bothub/common/migrations/0074_auto_20200806_1501.py on lines 0..65
                bothub/common/migrations/0075_auto_20200806_1805.py on lines 0..65

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

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

                Severity: Major
                Found in bothub/common/migrations/0074_auto_20200806_1501.py and 2 other locations - About 1 day to fix
                bothub/common/migrations/0075_auto_20200806_1805.py on lines 0..65
                bothub/common/migrations/0077_auto_20200807_1410.py on lines 0..65

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

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

                Severity: Major
                Found in bothub/common/migrations/0075_auto_20200806_1805.py and 2 other locations - About 1 day to fix
                bothub/common/migrations/0074_auto_20200806_1501.py on lines 0..65
                bothub/common/migrations/0077_auto_20200807_1410.py on lines 0..65

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

                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 settings.py has 530 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import os
                
                import environ
                import sentry_sdk
                
                
                Severity: Major
                Found in bothub/settings.py - About 1 day to fix

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

                  Severity: Major
                  Found in bothub/common/migrations/0076_auto_20200806_1830.py and 1 other location - About 1 day to fix
                  bothub/common/migrations/0055_auto_20200518_1810.py on lines 0..57

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

                  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

                  Severity: Major
                  Found in bothub/common/migrations/0055_auto_20200518_1810.py and 1 other location - About 1 day to fix
                  bothub/common/migrations/0076_auto_20200806_1830.py on lines 0..57

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

                  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.CreateModel(
                              name="RepositoryEntityGroup",
                              fields=[
                                  (
                                      "id",
                  Severity: Major
                  Found in bothub/common/migrations/0059_auto_20200525_1122.py and 1 other location - About 1 day to fix
                  bothub/common/migrations/0040_initial.py on lines 245..280

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

                  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.CreateModel(
                              name="RepositoryEntityLabel",
                              fields=[
                                  (
                                      "id",
                  Severity: Major
                  Found in bothub/common/migrations/0040_initial.py and 1 other location - About 1 day to fix
                  bothub/common/migrations/0059_auto_20200525_1122.py on lines 15..50

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

                  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 languages.py has 492 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  from django.utils.translation import ugettext_lazy as _
                  from django.conf import settings
                  from django.core.exceptions import ValidationError
                  
                  
                  
                  Severity: Minor
                  Found in bothub/common/languages.py - About 7 hrs to fix

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

                    class RepositoryMigratePermission(permissions.BasePermission):
                        def has_object_permission(self, request, view, obj):
                            authorization = obj.repository_version.repository.get_user_authorization(
                                request.user
                            )
                    Severity: Major
                    Found in bothub/api/v2/repository/permissions.py and 1 other location - About 7 hrs to fix
                    bothub/api/v2/repository/permissions.py on lines 74..88

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

                    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 RepositoryTrainInfoPermission(permissions.BasePermission):
                        def has_object_permission(self, request, view, obj):
                            authorization = obj.repository_version.repository.get_user_authorization(
                                request.user
                            )
                    Severity: Major
                    Found in bothub/api/v2/repository/permissions.py and 1 other location - About 7 hrs to fix
                    bothub/api/v2/repository/permissions.py on lines 91..105

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

                    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