dmyersturnbull/pocketutils

View on GitHub

Showing 96 of 96 total issues

Avoid too many return statements within this function.
Open

            return obj.Self
Severity: Major
Found in src/pocketutils/tools/json_tools.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return base64.b64decode(bytes(obj))
    Severity: Major
    Found in src/pocketutils/tools/json_tools.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return data
      Severity: Major
      Found in src/pocketutils/tools/json_tools.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return s
        Severity: Major
        Found in src/pocketutils/tools/string_tools.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return base64.b64decode(obj)
          Severity: Major
          Found in src/pocketutils/tools/json_tools.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return then.strftime(_today + "%H:%M:%S")
            Severity: Major
            Found in src/pocketutils/tools/unit_tools.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return then.strftime(_today + "%H:%M:%S.%f")
              Severity: Major
              Found in src/pocketutils/tools/unit_tools.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return wraps(func)(my_fn)
                Severity: Major
                Found in src/pocketutils/core/decorators.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return obj._asdict()
                  Severity: Major
                  Found in src/pocketutils/tools/json_tools.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return [self.prepare(e, inf_handling=inf_handling, nan_handling=nan_handling) for e in data]
                    Severity: Major
                    Found in src/pocketutils/tools/json_tools.py - About 30 mins to fix

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

                          def _exclude_fn(cls: type[Self], exclude) -> Callable[str, bool]:
                              if exclude is None or exclude is False:
                                  return lambda s: False
                              if isinstance(exclude, str):
                                  return lambda s: s == exclude
                      Severity: Minor
                      Found in src/pocketutils/core/decorators.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 build_traceback has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def build_traceback(self: Self, e: BaseException) -> Sequence[Frame]:
                              tb = []
                              current = None
                              tbe = traceback.TracebackException.from_exception(e)
                              last, repeats = None, 0
                      Severity: Minor
                      Found in src/pocketutils/tools/sys_tools.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 hash_digest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def hash_digest(
                              self: Self,
                              data: SupportsBytes | str,
                              algorithm: HashAlgorithm,
                              *,
                      Severity: Minor
                      Found in src/pocketutils/tools/io_tools.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_list_as has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def get_list_as(self: Self, items: str, as_type: type[T], default: list[T] | None = None) -> list[T]:
                              """
                              Gets list values from an *optional* key.
                              """
                              try:
                      Severity: Minor
                      Found in src/pocketutils/core/dot_dict.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 write has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def write(
                              self: Self,
                              data: Any,
                              path: PathLike,
                              *,
                      Severity: Minor
                      Found in src/pocketutils/core/smartio.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 sanitize_nodes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def sanitize_nodes(
                              self: Self,
                              bits: Sequence[PurePath | str],
                              *,
                              is_file: bool | None = None,
                      Severity: Minor
                      Found in src/pocketutils/tools/path_tools.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