collerek/ormar

View on GitHub
ormar/models/newbasemodel.py

Summary

Maintainability
D
2 days
Test Coverage
A
100%

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

    Function model_dump has 16 arguments (exceeds 6 allowed). Consider refactoring.
    Invalid

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

      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 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 model_dump_json has 12 arguments (exceeds 6 allowed). Consider refactoring.
        Invalid

            def model_dump_json(  # type: ignore # noqa A003
        Severity: Major
        Found in ormar/models/newbasemodel.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 _extract_nested_models has 9 arguments (exceeds 6 allowed). Consider refactoring.
            Open

                def _extract_nested_models(  # noqa: CCR001, CFQ002
            Severity: Major
            Found in ormar/models/newbasemodel.py - About 50 mins to fix

              There are no issues that match your filters.

              Category
              Status