owlmixin/transformers.py
File transformers.py
has 410 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
# coding: utf-8
from typing import Any, Iterator, List, Optional, Sequence
from owlmixin import util
from owlmixin.owloption import TOption
Function to_csvf
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def to_csvf(
Function to_jsonf
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def to_jsonf(
Function traverse
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
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):
- Read upRead up
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
Open
def to_csv(
Function to_yamlf
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def to_yamlf(
Avoid too many return
statements within this function. Open
Open
return value.to_dict(
Avoid too many return
statements within this function. Open
Open
return value
Avoid too many return
statements within this function. Open
Open
return traverse_list(list(value), ignore_none, force_value, ignore_empty)