douwevandermeij/fractal-repositories

View on GitHub

Showing 31 of 31 total issues

File mixins.py has 297 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from __future__ import annotations

import dataclasses
import logging
from abc import ABC, abstractmethod
Severity: Minor
Found in fractal_repositories/contrib/sqlalchemy/mixins.py - About 3 hrs to fix

    Function _find_raw has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def _find_raw(
            self,
            specification: Optional[Specification],
            *,
            entity_dao_class: Optional[EntityDao] = None,
    Severity: Minor
    Found in fractal_repositories/contrib/sqlalchemy/mixins.py - About 2 hrs 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 find has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def find(
            self,
            specification: Optional[Specification] = None,
            *,
            offset: int = 0,
    Severity: Minor
    Found in fractal_repositories/contrib/gcp/firestore/mixins.py - About 2 hrs 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 find has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def find(
            self,
            specification: Optional[Specification] = None,
            *,
            offset: int = 0,
    Severity: Minor
    Found in fractal_repositories/utils/distributed_read_repository.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 asdict has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def asdict(self, *, skip_types=None, use_timezone_z=False):
            if skip_types is None:
                skip_types = []
            field_names = set(
                f.name for f in fields(self) if f.name not in self.calculated_fields()
    Severity: Minor
    Found in fractal_repositories/core/entity.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 find_one has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def find_one(self, specification: Specification) -> EntityType:
            _filter = FirestoreSpecificationBuilder.build(specification)
            collection: Union[BaseCollectionReference, BaseQuery] = self.collection
            if _filter:
                if isinstance(_filter, list):
    Severity: Minor
    Found in fractal_repositories/contrib/gcp/firestore/mixins.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 __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in fractal_repositories/contrib/mongo/mixins.py - About 1 hr to fix

      Function __get_direct_related_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def __get_direct_related_data(self, entity: EntityType):
              direct_data = {}
              related_data = {}
      
              def field_name(field):
      Severity: Minor
      Found in fractal_repositories/contrib/django/mixins.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

      Function find_filter has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def find_filter(
      Severity: Major
      Found in fractal_repositories/mixins/filter_repository_mixin.py - About 50 mins to fix

        Function _find_raw has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def _find_raw(
        Severity: Minor
        Found in fractal_repositories/contrib/sqlalchemy/mixins.py - About 45 mins to fix

          Function __update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def __update(
                  self, entity: EntityType, entity_dao_class: EntityDao, *, upsert=False
              ) -> EntityType:
                  """Recursive function"""
                  with self:
          Severity: Minor
          Found in fractal_repositories/contrib/sqlalchemy/mixins.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

          Function __update_compound_entities has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def __update_compound_entities(self, entity, entity_dao_class, list_fields):
                  for field in list_fields:
                      item_dao_class = get_type_hints(entity_dao_class)[field].__args__[0]
          
                      # check for new items
          Severity: Minor
          Found in fractal_repositories/contrib/sqlalchemy/mixins.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

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

          def setup_mongo_connection(
          Severity: Minor
          Found in fractal_repositories/contrib/mongo/mixins.py - About 35 mins to fix

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

                def find(
            Severity: Minor
            Found in fractal_repositories/contrib/gcp/firestore/mixins.py - About 35 mins to fix

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

                  def find(
              Severity: Minor
              Found in fractal_repositories/utils/distributed_read_repository.py - About 35 mins to fix

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

                    def find(
                Severity: Minor
                Found in fractal_repositories/mixins/inmemory_repository_mixin.py - About 35 mins to fix

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

                      def find(
                  Severity: Minor
                  Found in fractal_repositories/contrib/mongo/mixins.py - About 35 mins to fix

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

                        def find(
                    Severity: Minor
                    Found in fractal_repositories/contrib/sqlalchemy/mixins.py - About 35 mins to fix

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

                          def find(
                      Severity: Minor
                      Found in fractal_repositories/core/repositories.py - About 35 mins to fix

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

                            def find(
                        Severity: Minor
                        Found in fractal_repositories/utils/cached_repository.py - About 35 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language