collerek/ormar

View on GitHub

Showing 43 of 53 total issues

File queryset.py has 1040 lines of code (exceeds 500 allowed). Consider refactoring.
Open

import asyncio
from typing import (
    TYPE_CHECKING,
    Any,
    AsyncGenerator,
Severity: Major
Found in ormar/queryset/queryset.py - About 1 day to fix

    File newbasemodel.py has 1026 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    import base64
    import sys
    import warnings
    from typing import (
        TYPE_CHECKING,
    Severity: Major
    Found in ormar/models/newbasemodel.py - About 1 day to fix

      File querysetproxy.py has 714 lines of code (exceeds 500 allowed). Consider refactoring.
      Open

      from typing import (  # noqa: I100, I201
          TYPE_CHECKING,
          Any,
          AsyncGenerator,
          Dict,
      Severity: Major
      Found in ormar/relations/querysetproxy.py - About 7 hrs to fix

        File model_fields.py has 660 lines of code (exceeds 500 allowed). Consider refactoring.
        Open

        import datetime
        import decimal
        import uuid
        from enum import Enum as E
        from enum import EnumMeta
        Severity: Major
        Found in ormar/fields/model_fields.py - About 5 hrs to fix

          File metaclass.py has 635 lines of code (exceeds 500 allowed). Consider refactoring.
          Open

          import copy
          import sys
          import warnings
          from pathlib import Path
          from typing import (
          Severity: Major
          Found in ormar/models/metaclass.py - About 5 hrs to fix

            File prefetch_query.py has 503 lines of code (exceeds 500 allowed). Consider refactoring.
            Open

            import abc
            import logging
            from abc import abstractmethod
            from typing import (
                TYPE_CHECKING,
            Severity: Major
            Found in ormar/queryset/queries/prefetch_query.py - About 2 hrs to fix

              Function __init__ has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def __init__(self, **kwargs: Any) -> None:
                      self.__type__: type = kwargs.pop("__type__", None)
                      self.__pydantic_type__: type = kwargs.pop("__pydantic_type__", None)
                      self.__sample__: type = kwargs.pop("__sample__", None)
                      self.related_name = kwargs.pop("related_name", None)
              Severity: Minor
              Found in ormar/fields/base.py - About 1 hr to fix

                Function substitute_models_with_pks has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
                Open

                    def substitute_models_with_pks(cls, model_dict: Dict) -> Dict:  # noqa  CCR001
                        """
                        Receives dictionary of model that is about to be saved and changes all related
                        models that are stored as foreign keys to their fk value.
                
                
                Severity: Minor
                Found in ormar/models/mixins/save_mixin.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 subtract_dict has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
                Open

                def subtract_dict(current_dict: Any, updating_dict: Any) -> Dict:  # noqa: CCR001
                    """
                    Update one dict with another but with regard for nested keys.
                
                    That way nested sets are unionised, dicts updated and
                Severity: Minor
                Found in ormar/queryset/utils.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 _extract_nested_models has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring.
                Open

                    def _extract_nested_models(  # noqa: CCR001, CFQ002
                        self,
                        relation_map: Dict,
                        dict_instance: Dict,
                        include: Optional[Dict],
                Severity: Minor
                Found in ormar/models/newbasemodel.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 14 arguments (exceeds 6 allowed). Consider refactoring.
                Open

                    def __init__(  # noqa:  CFQ002
                Severity: Major
                Found in ormar/queryset/join.py - About 1 hr to fix

                  Function dict has 13 arguments (exceeds 6 allowed). Consider refactoring.
                  Open

                      def dict(  # type: ignore # noqa A003
                  Severity: Major
                  Found in ormar/models/newbasemodel.py - About 1 hr to fix

                    Function __init__ has 12 arguments (exceeds 6 allowed). Consider refactoring.
                    Open

                        def __init__(  # noqa CFQ002
                    Severity: Major
                    Found in ormar/queryset/queryset.py - About 1 hr to fix

                      Function json has 12 arguments (exceeds 6 allowed). Consider refactoring.
                      Open

                          def json(  # type: ignore # noqa A003
                      Severity: Major
                      Found in ormar/models/newbasemodel.py - About 1 hr to fix

                        Function ForeignKey has 11 arguments (exceeds 6 allowed). Consider refactoring.
                        Open

                        def ForeignKey(  # type: ignore # noqa CFQ002
                        Severity: Major
                        Found in ormar/fields/foreign_key.py - About 1 hr to fix

                          Function rebuild_self has 11 arguments (exceeds 6 allowed). Consider refactoring.
                          Open

                              def rebuild_self(  # noqa: CFQ002
                          Severity: Major
                          Found in ormar/queryset/queryset.py - About 1 hr to fix

                            Function _populate_nested_models_from_row has 10 arguments (exceeds 6 allowed). Consider refactoring.
                            Open

                                def _populate_nested_models_from_row(  # noqa: CFQ002
                            Severity: Major
                            Found in ormar/models/model_row.py - About 1 hr to fix

                              Function from_row has 10 arguments (exceeds 6 allowed). Consider refactoring.
                              Open

                                  def from_row(  # noqa: CFQ002
                              Severity: Major
                              Found in ormar/models/model_row.py - About 1 hr to fix

                                Function __init__ has 10 arguments (exceeds 6 allowed). Consider refactoring.
                                Open

                                    def __init__(  # noqa CFQ002
                                Severity: Major
                                Found in ormar/queryset/queries/query.py - About 1 hr to fix

                                  Function __new__ has 10 arguments (exceeds 6 allowed). Consider refactoring.
                                  Open

                                      def __new__(  # type: ignore # noqa CFQ002
                                  Severity: Major
                                  Found in ormar/fields/model_fields.py - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language