fabiommendes/sidekick

View on GitHub
sidekick-types/sidekick/types/named_record.py

Summary

Maintainability
B
5 hrs
Test Coverage

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

def new_record_type(
Severity: Major
Found in sidekick-types/sidekick/types/named_record.py - About 50 mins to fix

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

        def define(
            self,
            name: str,
            fields: list,
            bases=(),
    Severity: Minor
    Found in sidekick-types/sidekick/types/named_record.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 define has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def define(
    Severity: Minor
    Found in sidekick-types/sidekick/types/named_record.py - About 45 mins to fix

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

      def clean_field(field, use_invalid=False):
          """
          Coerce argument to a Field instance.
          """
          tt = object
      Severity: Minor
      Found in sidekick-types/sidekick/types/named_record.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 normalize_field_mapping has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def normalize_field_mapping(fields):
          """
          Normalize each declaration in a field mapping.
          """
          for name, value in fields.items():
      Severity: Minor
      Found in sidekick-types/sidekick/types/named_record.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 __new__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __new__(mcs, name, bases, ns, use_invalid=False, **kwargs):
      Severity: Minor
      Found in sidekick-types/sidekick/types/named_record.py - About 35 mins to fix

        Function __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(*args, **extra):
                self, *args = args
                cls = type(self)
                args = dict(zip(self._meta.fields, args))
                kwargs = dict(self._meta.defaults)
        Severity: Minor
        Found in sidekick-types/sidekick/types/named_record.py - About 25 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 extract_fields_from_annotations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def extract_fields_from_annotations(bases, ns):
            annotations = {}
            annotations.update(ns.get("__annotations__", ()))
            for base in bases:
                if isinstance(base, RecordMeta):
        Severity: Minor
        Found in sidekick-types/sidekick/types/named_record.py - About 25 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 make_init_function_code has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def make_init_function_code(names_map: dict, defaults: Mapping) -> str:
            """
            Return a string with source code for the init function.
            """
        
        
        Severity: Minor
        Found in sidekick-types/sidekick/types/named_record.py - About 25 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

        There are no issues that match your filters.

        Category
        Status