fabiommendes/sidekick

View on GitHub

Showing 157 of 157 total issues

Function from_operator has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def from_operator(cls, op, unit=None, unit_factory=None):
        """
        Creates monoid from binary operator.
        """
        if unit is not None:
Severity: Minor
Found in sidekick-functions/sidekick/functions/fn_interfaces.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 __getitem__ has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def __getitem__(self, cls):
        try:
            return ZOMBIE_CLASSES[cls]
        except KeyError:
            pass
Severity: Minor
Found in sidekick-proxy/sidekick/proxy/zombie.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 juxt has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def juxt(*funcs: Callable, first=None, last=None) -> fn:
    """
    Juxtapose several functions.

    Creates a function that calls several functions with the same arguments and
Severity: Minor
Found in sidekick-functions/sidekick/functions/lib_composition.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 compile_regex_function has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def compile_regex_function(expr):
    """
    Compile an regex expression of type:

    * "/<regex>/" -> simple regex match. Return match objects.
Severity: Minor
Found in sidekick-functions/sidekick/functions/core_functions.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 __init__ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, children=(), *, parent=None, leaf_class=None, **kwargs):
        self._attrs = kwargs
        self._parent = parent
        self._children = []

Severity: Minor
Found in sidekick-tree/sidekick/tree/node_classes.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 _chunks_sizes_ex has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def _chunks_sizes_ex(ns, seq, drop, pad):
    buf = []
    clear = buf.clear
    fill = buf.extend
    seq = iter(seq)
Severity: Minor
Found in sidekick-seq/sidekick/seq/lib_grouping.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 cycle_n has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def cycle_n(seq, n):
    data = []
    store = data.append
    consumed = False

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

def export_tree(obj: NodeOrLeaf, file=None, format="dict", **kwargs):
    """
    Export tree to given format data source.
    """
    if format == "dict":
Severity: Minor
Found in sidekick-tree/sidekick/tree/io.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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

make_op = lambda op: lambda _, cte: lambda v: fmap(lambda x: op(x, cte), v)
sidekick-experimental/sidekick/experimental/magics/argument_magics.py on lines 6..6

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 40.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

make_rop = lambda op: lambda _, cte: lambda v: fmap(lambda x: op(cte, x), v)
sidekick-experimental/sidekick/experimental/magics/argument_magics.py on lines 5..5

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 40.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function op_wrapper_class has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

def op_wrapper_class(
Severity: Major
Found in sidekick-api/sidekick/api/_operators.py - About 1 hr to fix

    Function __init__ has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in sidekick-tree/sidekick/tree/io.py - About 1 hr to fix

      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 register_fluent_interface has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def register_fluent_interface(ns=globals(), blacklist=()):
          from ..functions import fn
      
          def make_method(idx, func, sig):
              @wraps(func)
      Severity: Minor
      Found in sidekick-seq/sidekick/seq/__init__.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 last has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def last(seq: Seq[T], default=NOT_GIVEN, n=None) -> T:
          """
          Return last item (or items) of sequence.
      
          Args:
      Severity: Minor
      Found in sidekick-seq/sidekick/seq/lib_basic.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 _peek_direct has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def _peek_direct(seq, size, default):
          if size is NOT_GIVEN:
              try:
                  elem, out = _peek(seq)
              except StopIteration:
      Severity: Minor
      Found in sidekick-seq/sidekick/seq/lib_basic.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 _create_fn_functions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def _create_fn_functions(mod, ns, arities=None, flipped=(), blacklist=()):
          arities = arities or {}
          for k in _dir(mod):
              if k.startswith("_") or k in ns or k in blacklist:
                  continue
      Severity: Minor
      Found in sidekick-experimental/sidekick/experimental/contrib/builtins.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 catching has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def catching(errors: Catchable, func: Func):
          """
          Similar to catch, but decorates a function rewriting its error handling
          policy.
      
      
      Severity: Minor
      Found in sidekick-functions/sidekick/functions/lib_runtime.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 __getitem__ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def __getitem__(self, i):
              if isinstance(i, int):
                  if i > 0:
                      for idx, x in enumerate(self):
                          if idx == i:
      Severity: Minor
      Found in sidekick-experimental/sidekick/experimental/queue.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

      Severity
      Category
      Status
      Source
      Language