tadashi-aikawa/owlmixin

View on GitHub
owlmixin/transformers.py

Summary

Maintainability
C
1 day
Test Coverage

File transformers.py has 410 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# coding: utf-8
from typing import Any, Iterator, List, Optional, Sequence

from owlmixin import util
from owlmixin.owloption import TOption
Severity: Minor
Found in owlmixin/transformers.py - About 5 hrs to fix

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

        def to_csvf(
    Severity: Major
    Found in owlmixin/transformers.py - About 50 mins to fix

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

          def to_jsonf(
      Severity: Minor
      Found in owlmixin/transformers.py - About 45 mins to fix

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

        def traverse(value, ignore_none=True, force_value=False, ignore_empty=False):
            # pylint: disable=too-many-return-statements
            if force_value and isinstance(value, ValueTransformer):
                return value.to_value(ignore_none, force_value)
            if isinstance(value, TOption):
        Severity: Minor
        Found in owlmixin/transformers.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 to_csv has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def to_csv(
        Severity: Minor
        Found in owlmixin/transformers.py - About 35 mins to fix

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

              def to_yamlf(
          Severity: Minor
          Found in owlmixin/transformers.py - About 35 mins to fix

            Avoid too many return statements within this function.
            Open

                    return value.to_dict(
            Severity: Major
            Found in owlmixin/transformers.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return value
              Severity: Major
              Found in owlmixin/transformers.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return traverse_list(list(value), ignore_none, force_value, ignore_empty)
                Severity: Major
                Found in owlmixin/transformers.py - About 30 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status