bitranox/lib_log_utils

View on GitHub
lib_log_utils/lib_log_utils_cli.py

Summary

Maintainability
D
1 day
Test Coverage
A
98%

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

        def do_log(
            message: str,
            level_str: str = "info",
            extended: Optional[bool] = None,
            banner: bool = False,
        Severity: Minor
        Found in lib_log_utils/lib_log_utils_cli.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

        There are no issues that match your filters.

        Category
        Status