the-deep/server

View on GitHub

Showing 152 of 159 total issues

Function add_entries_from_excel_data has a Cognitive Complexity of 114 (exceeds 12 allowed). Consider refactoring.
Open

def add_entries_from_excel_data(self, rows, data, export_data):
export_type = data.get('type')
 
if export_type == 'nested':
children = data.get('children')
Severity: Minor
Found in apps/export/entries/excel_exporter.py - About 2 days to fix

Function get_filtered_entries_using_af_filter has a Cognitive Complexity of 71 (exceeds 12 allowed). Consider refactoring.
Open

def get_filtered_entries_using_af_filter(
entries, filters, queries,
project=None, new_query_structure=False,
):
queries = copy.deepcopy(queries)
Severity: Minor
Found in apps/entry/filter_set.py - About 1 day to fix

Function _generate_for_entry has a Cognitive Complexity of 65 (exceeds 12 allowed). Consider refactoring.
Open

def _generate_for_entry(self, entry):
"""
Generate paragraphs for an entry
"""
 
 
Severity: Minor
Found in apps/export/entries/report_exporter.py - About 1 day to fix

Function add_assessment_to_rows has a Cognitive Complexity of 63 (exceeds 12 allowed). Consider refactoring.
Open

def add_assessment_to_rows(sheets, assessment, planned_assessment=False):
"""
sheets = {
sheet1: {
grouped_col: [
Severity: Minor
Found in apps/ary/export/__init__.py - About 1 day to fix

File handlers.py has 1230 lines of code (exceeds 999 allowed). Consider refactoring.
Open

import os
import json
import copy
import requests
import logging
Severity: Major
Found in apps/deepl_integration/handlers.py - About 7 hrs to fix

    AssessmentDashboardStatisticsType has 45 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class AssessmentDashboardStatisticsType(graphene.ObjectType):
    total_assessment = graphene.Int(required=True)
    total_stakeholder = graphene.Int(required=True)
    total_collection_technique = graphene.Int(required=True)
    assessment_count = graphene.List(graphene.NonNull(AssessmentCountType))
    Severity: Minor
    Found in apps/assessment_registry/dashboard_schema.py - About 6 hrs to fix

      Function _get_geo_admin_level_1_data has a Cognitive Complexity of 37 (exceeds 12 allowed). Consider refactoring.
      Open

      def _get_geo_admin_level_1_data(self, geo_id_values):
      if len(geo_id_values) == 0:
      return
       
      render_values = []
      Severity: Minor
      Found in apps/export/entries/report_exporter.py - About 4 hrs to fix

      Command has 34 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Command(MigrationCommand):
      def run(self):
      if self.kwargs.get('data_file'):
      with open(self.kwargs['data_file']) as f:
      frameworks = json.load(f)
      Severity: Minor
      Found in apps/deep_migration/management/commands/migrate_analysis_framework.py - About 4 hrs to fix

        Function handle has a Cognitive Complexity of 36 (exceeds 12 allowed). Consider refactoring.
        Open

        def handle(self, *args, **kwargs):
        widget_qs = Widget.objects.exclude(version=self.CURRENT_VERSION)
        attribute_qs = Attribute.objects.exclude(widget_version=self.CURRENT_VERSION)
         
        # Migrate Widget Data
        Severity: Minor
        Found in apps/deep_migration/management/commands/migrate_af_changes_v2_v3.py - About 4 hrs to fix

        Function extract has a Cognitive Complexity of 34 (exceeds 12 allowed). Consider refactoring.
        Open

        def extract(book, filename=None):
        options = book.options if book.options else {}
        Sheet.objects.filter(book=book).delete() # Delete all previous sheets
        with open(filename, 'rb') if filename else book.get_file() as xlsx_file:
        workbook = load_workbook(xlsx_file, data_only=True, read_only=True)
        Severity: Minor
        Found in apps/tabular/extractor/xlsx.py - About 3 hrs to fix

        Function get_enum_name_from_django_field has a Cognitive Complexity of 33 (exceeds 12 allowed). Consider refactoring.
        Open

        def get_enum_name_from_django_field(
        field: Union[
        None,
        serializers.ChoiceField,
        models.CharField,
        Severity: Minor
        Found in utils/graphene/enums.py - About 3 hrs to fix

        GraphQLTestCase has 29 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class GraphQLTestCase(BaseGraphQLTestCase):
        """
        GraphQLTestCase with custom helper methods
        """
         
         
        Severity: Minor
        Found in utils/graphene/tests.py - About 3 hrs to fix

          Function serializer_error_to_error_types has a Cognitive Complexity of 31 (exceeds 12 allowed). Consider refactoring.
          Open

          def serializer_error_to_error_types(errors: dict, initial_data: dict = None) -> List:
          initial_data = initial_data or dict()
          node_client_id = initial_data.get('client_id')
          error_types = list()
          for field, value in errors.items():
          Severity: Minor
          Found in utils/graphene/error_types.py - About 3 hrs to fix

          Function update_attribute has a Cognitive Complexity of 31 (exceeds 12 allowed). Consider refactoring.
          Open

          def update_attribute(widget, data, widget_properties):
          data = (data or {}).get('value', {})
          rows = widget_properties.get('rows', [])
          columns = widget_properties.get('columns', [])
           
           
          Severity: Minor
          Found in apps/entry/widgets/matrix2d_widget.py - About 3 hrs to fix

          Function export_af_to_csv has a Cognitive Complexity of 30 (exceeds 12 allowed). Consider refactoring.
          Open

          def export_af_to_csv(af, file):
          """
          Only extracts this widgets
          - matrix1dWidget
          - matrix2dWidget
          Severity: Minor
          Found in apps/analysis_framework/export.py - About 3 hrs to fix

          Command has 27 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Command(MigrationCommand):
          def run(self):
          if self.kwargs.get('data_file'):
          with open(self.kwargs['data_file']) as f:
          entries = json.load(f)
          Severity: Minor
          Found in apps/deep_migration/management/commands/migrate_entry.py - About 3 hrs to fix

            Function _generate_for_entry_widget_data has a Cognitive Complexity of 28 (exceeds 12 allowed). Consider refactoring.
            Open

            def _generate_for_entry_widget_data(self, entry, para):
            if entry.id not in self.entry_widget_data_cache:
            raw_export_data = []
            for each in entry.exportdata_set.all():
            export_datum = {
            Severity: Minor
            Found in apps/export/entries/report_exporter.py - About 2 hrs to fix

            Function xml2text has a Cognitive Complexity of 26 (exceeds 12 allowed). Consider refactoring.
            Open

            def xml2text(xml, pptx=False):
            """
            A string representing the textual content of this run, with content
            child elements like ``<w:tab/>`` translated to their Python
            equivalent.
            Severity: Minor
            Found in utils/extractor/formats/docx.py - About 2 hrs to fix

            ProjectViewSet has 23 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class ProjectViewSet(viewsets.ModelViewSet):
            permission_classes = [permissions.IsAuthenticated,
            ModifyPermission]
            filter_backends = (django_filters.rest_framework.DjangoFilterBackend,
            filters.SearchFilter, filters.OrderingFilter)
            Severity: Minor
            Found in apps/project/views.py - About 2 hrs to fix

              ExploreDashboardStatType has 23 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class ExploreDashboardStatType(graphene.ObjectType):
              total_projects = graphene.Int(required=True)
              total_registered_users = graphene.Int(required=True)
              total_leads = graphene.Int(required=True)
              total_entries = graphene.Int(required=True)
              Severity: Minor
              Found in apps/deep_explore/schema.py - About 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language