fabiommendes/sidekick

View on GitHub
sidekick-seq/sidekick/seq/lib_selecting.py

Summary

Maintainability
C
1 day
Test Coverage

Function unique has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

def unique(seq: Seq, *, key: Func = None, exclude: Seq = (), slow=False) -> Iter:
    """
    Returns the given sequence with duplicates removed.

    Preserves order. If key is supplied map distinguishes values by comparing
Severity: Minor
Found in sidekick-seq/sidekick/seq/lib_selecting.py - About 2 hrs 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 dedupe has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def dedupe(seq: Seq, *, key: Func = None) -> Iter:
    """
    Remove duplicates of successive elements.

    Args:
Severity: Minor
Found in sidekick-seq/sidekick/seq/lib_selecting.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 _take_at has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def _take_at(indices, seq):
    idx = next(indices, None)
    if idx is None:
        return
    for i, x in enumerate(seq):
Severity: Minor
Found in sidekick-seq/sidekick/seq/lib_selecting.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 rdrop has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def rdrop(key: Union[Pred, int], seq: Seq) -> Iter:
    """
    Drop items from the end of iterable.

    Examples:
Severity: Minor
Found in sidekick-seq/sidekick/seq/lib_selecting.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 _drop_at_lazy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def _drop_at_lazy(indices, seq):
    idx = next(indices, None)
    if idx is None:
        return
    for i, x in enumerate(seq):
Severity: Minor
Found in sidekick-seq/sidekick/seq/lib_selecting.py - About 55 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 rtake has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def rtake(key: Union[Pred, int], seq: Seq) -> Iter:
    """
    Return the last entries iterable.

    Examples:
Severity: Minor
Found in sidekick-seq/sidekick/seq/lib_selecting.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 separate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def separate(pred: Func, seq: Seq, consume: bool = False) -> (Seq, Seq):
    """
    Split sequence it two. The first consists of items that pass the
    predicate and the second of those items that don't.

Severity: Minor
Found in sidekick-seq/sidekick/seq/lib_selecting.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 indexed has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def indexed(transform, func: Callable, seq: Seq, *, start=0) -> Seq:
Severity: Minor
Found in sidekick-seq/sidekick/seq/lib_selecting.py - About 35 mins to fix

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

    def unique(seq: Seq, *, key: Func = None, exclude: Seq = (), slow=False) -> Iter:
    Severity: Minor
    Found in sidekick-seq/sidekick/seq/lib_selecting.py - About 35 mins to fix

      There are no issues that match your filters.

      Category
      Status