fabiommendes/sidekick

View on GitHub

Showing 157 of 157 total issues

Avoid too many return statements within this function.
Open

                return [data[i] for i in item]
Severity: Major
Found in sidekick-seq/sidekick/seq/iter.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return Iter(_chunks_split(func, seq))
    Severity: Major
    Found in sidekick-seq/sidekick/seq/lib_grouping.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return Iter(compress_or_select(item, self._iterator), size)
      Severity: Major
      Found in sidekick-seq/sidekick/seq/iter.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return ast
        Severity: Major
        Found in sidekick-functions/sidekick/functions/fn_placeholders.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return Iter(_chunks_sizes_ex(n, seq, False, pad))
          Severity: Major
          Found in sidekick-seq/sidekick/seq/lib_grouping.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                            return [x for key, x in zip(item, data) if key]
            Severity: Major
            Found in sidekick-seq/sidekick/seq/iter.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return Iter(_chunks_sizes(n, seq))
              Severity: Major
              Found in sidekick-seq/sidekick/seq/lib_grouping.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return fn(_juxt(*funcs))
                Severity: Major
                Found in sidekick-functions/sidekick/functions/lib_composition.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return Call(caller, args, kwargs)
                  Severity: Major
                  Found in sidekick-functions/sidekick/functions/fn_placeholders.py - About 30 mins to fix

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

                        def consume_until(self, n: int):
                            """
                            Consume iterator until list reaches at most size n.
                            """
                    
                    
                    Severity: Minor
                    Found in sidekick-collections/sidekick/collections/lazylist.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 __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 _ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def _(ast):
                        # Optimizations:
                        #   * Var nodes are handled more efficiently with operator.attrgetter
                        #   * Call nodes are handled with operator.methodcaller, when possible
                        #   * Chained getattrs are also handled with operator.attrgetter
                    Severity: Minor
                    Found in sidekick-functions/sidekick/functions/fn_placeholders.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 __call__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def __call__(self, *args, **kwargs):
                            if not args and not kwargs:
                                raise TypeError("curried function cannot be called without arguments")
                    
                            try:
                    Severity: Minor
                    Found in sidekick-functions/sidekick/functions/fn.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 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 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 make_init_function_code has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def make_init_function_code(names_map: dict, defaults: Mapping) -> str:
                        """
                        Return a string with source code for the init function.
                        """
                    
                    
                    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 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 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 _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

                    Severity
                    Category
                    Status
                    Source
                    Language