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
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
- Read upRead up
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(
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
- Read upRead up
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
- Read upRead up
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
- Read upRead up
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(
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,
- Read upRead up
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"