fabiommendes/sidekick

View on GitHub

Showing 155 of 157 total issues

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

def make_xor(f, g):
    """
    Compose functions in a short-circuit version of xor using the following
    table:

Severity: Minor
Found in sidekick-functions/sidekick/functions/core_functions.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 __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 tree_nodes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def tree_nodes(root: Seq, follow: Pred = is_seqcont, children: Func = iter) -> Seq:
    """
    A way to list or iterate over all the tree nodes.

    This iterator includes both leaf nodes and branches.
Severity: Minor
Found in sidekick-experimental/sidekick/experimental/seq_nested.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 _is_identical has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _is_identical(
    value,
    name=None,
    render=None,
    doc=None,
Severity: Minor
Found in sidekick-functions/sidekick/functions/pred.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 get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get(self, timeout=None, *, default=NOT_GIVEN):
        """
        Return result of computation.

        Can set optional timeout and default arguments.
Severity: Minor
Found in sidekick-functions/sidekick/functions/lib_runtime.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 _generator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _generator(self, iterator, default):
        queue = self._tail_iters
        pop = queue.popleft

        yield from iterator
Severity: Minor
Found in sidekick-experimental/sidekick/experimental/iterators.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 __repr__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def __repr__(self):
        it = self._iterator
        head = []
        for _ in range(7):
            try:
Severity: Minor
Found in sidekick-seq/sidekick/seq/iter.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 first_repeated has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def first_repeated(key: Pred, seq: Seq[T], default=NOT_GIVEN) -> Tuple[int, T]:
    """
    Return the index and value of first repeated element in sequence by predicate.

    Raises a ValueError if no repeated element is found.
Severity: Minor
Found in sidekick-seq/sidekick/seq/lib_basic.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 discard_child has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def discard_child(self, child, raises=False):
        """
        Discard child if present in tree.
        """
        for idx, elem in self._children:
Severity: Minor
Found in sidekick-tree/sidekick/tree/node_classes.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 import_tree has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def import_tree(obj, how="dict", **kwargs):
    """
    Import tree from data source.
    """
    if how == "dict":
Severity: Minor
Found in sidekick-tree/sidekick/tree/io.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 parent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def parent(self, value):
        if value is None:
            self._parent = None
        elif not isinstance(value, Node):
            raise TypeError(f"Parent node {value!r} is not of type 'Node'.")
Severity: Minor
Found in sidekick-tree/sidekick/tree/node_base.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 _rpipe has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def _rpipe(obj, funcs):
    for func in funcs:
        if isinstance(obj, Err):
            return obj
        elif isinstance(obj, Ok):
Severity: Minor
Found in sidekick-types/sidekick/types/result.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 chunks_by has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def chunks_by(func: Func, seq: Seq, how: ChunksHow = "values") -> Iter:
    """
    Partition sequence into chunks according to a function.

    It creates a new partition every time the value of func(item) changes.
Severity: Minor
Found in sidekick-seq/sidekick/seq/lib_grouping.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 alias has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def alias(attr, *, transform=None, prepare=None, **kwargs) -> Any:
    """
    An alias to another attribute.

    Aliasing is another simple form of self-delegation. Aliases are views over
Severity: Minor
Found in sidekick-properties/sidekick/properties/properties.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

Severity
Category
Status
Source
Language