dmyersturnbull/pocketutils

View on GitHub

Showing 96 of 96 total issues

Function get_info has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def get_info(self: Self, path: PurePath | str, *, expand_user: bool = False, strict: bool = False) -> PathInfo:
        path = Path(path)
        has_ignore_error = hasattr(pathlib, "_ignore_error")
        if not has_ignore_error:
            logger.debug("No _ignore_error found; some OSErrors may be suppressed")
Severity: Minor
Found in src/pocketutils/tools/filesys_tools.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 get_encoding has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def get_encoding(self: Self, encoding: str = "utf-8") -> str:
        """
        Returns a text encoding from a more flexible string.
        Ignores hyphens and lowercases the string.
        Permits these nonstandard shorthands:
Severity: Minor
Found in src/pocketutils/tools/io_tools.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 verify_can_write_dirs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def verify_can_write_dirs(
        cls: type[Self],
        *paths: str | PurePath,
        missing_ok: bool = False,
    ) -> None:
Severity: Minor
Found in src/pocketutils/tools/filesys_tools.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 approx_time_wrt has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def approx_time_wrt(
        self: Self,
        now: date | datetime,
        then: date | datetime,
        *,
Severity: Minor
Found in src/pocketutils/tools/unit_tools.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 strip_paired has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def strip_paired(self: Self, text: str, pieces: Iterable[tuple[str, str] | str]) -> str:
        """
        Strips pairs of (start, end) from the ends of strings.

        Example:
Severity: Minor
Found in src/pocketutils/tools/string_tools.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 __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(
Severity: Major
Found in src/pocketutils/core/exceptions.py - About 50 mins to fix

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

        def __init__(
    Severity: Minor
    Found in src/pocketutils/core/exceptions.py - About 45 mins to fix

      Function smart_log has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def smart_log(
              self: Self,
              is_stderr: bool,
              line: bytes,
              *,
      Severity: Minor
      Found in src/pocketutils/tools/call_tools.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 pretty_object has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def pretty_object(self: Self, thing: Any, *, with_addr: bool = False) -> str:
              """
              Get a better and shorter name for a function than str(function).
              Ex: `pprint_function(lambda s: s)  == '<λ>'`
      
      
      Severity: Minor
      Found in src/pocketutils/tools/string_tools.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 new_default has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def new_default(
              self: Self,
              *fallbacks: Callable[[Any], Any] | None,
              first: Callable[[Any], Any] | None = _misc_types_default,
              last: Callable[[Any], Any] | None = str,
      Severity: Minor
      Found in src/pocketutils/tools/json_tools.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 sanitize_path has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def sanitize_path(
      Severity: Minor
      Found in src/pocketutils/tools/path_tools.py - About 45 mins to fix

        Function write has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def write(
        Severity: Minor
        Found in src/pocketutils/core/smartio.py - About 45 mins to fix

          Function only has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def only(
          Severity: Minor
          Found in src/pocketutils/tools/common_tools.py - About 45 mins to fix

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

                def __init__(
            Severity: Minor
            Found in src/pocketutils/core/exceptions.py - About 45 mins to fix

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

                  def __init__(
              Severity: Minor
              Found in src/pocketutils/core/exceptions.py - About 45 mins to fix

                Function encoder has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def encoder(
                Severity: Minor
                Found in src/pocketutils/tools/json_tools.py - About 45 mins to fix

                  Function sanitize_node has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def sanitize_node(
                  Severity: Minor
                  Found in src/pocketutils/tools/path_tools.py - About 45 mins to fix

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

                        def __init__(
                    Severity: Minor
                    Found in src/pocketutils/core/exceptions.py - About 45 mins to fix

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

                          def __init__(
                      Severity: Minor
                      Found in src/pocketutils/core/exceptions.py - About 45 mins to fix

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

                            def __init__(
                        Severity: Minor
                        Found in src/pocketutils/core/exceptions.py - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language