bitranox/lib_log_utils

View on GitHub

Showing 37 of 37 total issues

File lib_log_utils.py has 381 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# STDLIB
from typing import Optional, Union

import logging
import logging.handlers
Severity: Minor
Found in lib_log_utils/lib_log_utils.py - About 5 hrs to fix

    File lib_log_utils_cli.py has 351 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # STDLIB
    import logging
    import os
    import sys
    from typing import Optional
    Severity: Minor
    Found in lib_log_utils/lib_log_utils_cli.py - About 4 hrs to fix

      Function log_level has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

      def log_level(
          message: str,
          level: Optional[int] = None,
          width: Optional[int] = None,
          wrap: Optional[bool] = None,
      Severity: Minor
      Found in lib_log_utils/lib_log_utils.py - About 4 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

      File log_handlers.py has 267 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # STDLIB
      import logging
      import logging.handlers
      import getpass
      import os
      Severity: Minor
      Found in lib_log_utils/log_handlers.py - About 2 hrs to fix

        Function set_width_from_env has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        def set_width_from_env(width: Optional[int] = None, force: bool = False) -> None:
            # env settings have precedence, unless force=True - if nothing is passed, the default value will be used
            """
            >>> # Setup
            >>> default_banner_width = log_settings.width
        Severity: Minor
        Found in lib_log_utils/lib_log_utils_cli.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 cli_main has 13 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def cli_main(
        Severity: Major
        Found in lib_log_utils/lib_log_utils_cli.py - About 1 hr to fix

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

          def set_extended_from_env(extended: Optional[bool] = None, force: bool = False) -> None:
              # env settings have precedence, unless force=True - if nothing is passed, the default value will be used
              """
              >>> # Setup
              >>> default_fmt = log_settings.fmt
          Severity: Minor
          Found in lib_log_utils/lib_log_utils_cli.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 set_wrap_from_env has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          def set_wrap_from_env(wrap_text: Optional[bool] = None, force: bool = False) -> None:
              # env settings have precedence, unless force=True - if nothing is passed, the default value will be used
              """
              >>> # Setup
              >>> default_wrap_text = log_settings.wrap
          Severity: Minor
          Found in lib_log_utils/lib_log_utils_cli.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 set_quiet_from_env has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          def set_quiet_from_env(quiet: Optional[bool] = None, force: bool = False) -> None:
              # env settings have precedence, unless force=True - if nothing is passed, the default value will be used
              # parameter -q is anything else then "True" (not case sensitive), or not set, it is considered as False.
              """
              >>> # Setup
          Severity: Minor
          Found in lib_log_utils/lib_log_utils_cli.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 do_log has 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def do_log(
          Severity: Major
          Found in lib_log_utils/lib_log_utils_cli.py - About 1 hr to fix

            Function set_file_handler has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def set_file_handler(
            Severity: Major
            Found in lib_log_utils/log_handlers.py - About 1 hr to fix

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

              def set_stream_handler_color(
              Severity: Major
              Found in lib_log_utils/log_handlers.py - About 1 hr to fix

                Function set_stream_handler has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def set_stream_handler(
                Severity: Major
                Found in lib_log_utils/log_handlers.py - About 50 mins to fix

                  Function log_level has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def log_level(
                  Severity: Major
                  Found in lib_log_utils/lib_log_utils.py - About 50 mins to fix

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

                    def banner_debug(
                    Severity: Minor
                    Found in lib_log_utils/lib_log_utils.py - About 45 mins to fix

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

                      def log_verbose(
                      Severity: Minor
                      Found in lib_log_utils/lib_log_utils.py - About 45 mins to fix

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

                        def banner_notice(
                        Severity: Minor
                        Found in lib_log_utils/lib_log_utils.py - About 45 mins to fix

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

                          def log_debug(
                          Severity: Minor
                          Found in lib_log_utils/lib_log_utils.py - About 45 mins to fix

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

                            def log_warning(
                            Severity: Minor
                            Found in lib_log_utils/lib_log_utils.py - About 45 mins to fix

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

                              def banner_spam(
                              Severity: Minor
                              Found in lib_log_utils/lib_log_utils.py - About 45 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language