wikimedia/pywikibot

View on GitHub
pywikibot/config.py

Summary

Maintainability
C
1 day
Test Coverage

Function get_base_dir has a Cognitive Complexity of 43 (exceeds 10 allowed). Consider refactoring.
Open

def get_base_dir(test_directory: str | None = None,
                 config_file: str = 'user-config.py') -> str:
    r"""Return the directory in which user-specific information is stored.

    This is determined in the following order:
Severity: Minor
Found in pywikibot/config.py - About 5 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

Function register_families_folder has a Cognitive Complexity of 19 (exceeds 10 allowed). Consider refactoring.
Open

def register_families_folder(folder_path: str,
                             not_exists_ok: bool = False) -> None:
    """Register all family class files contained in a directory.

    .. versionadded:: 7.0
Severity: Minor
Found in pywikibot/config.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 _check_user_config_types has a Cognitive Complexity of 17 (exceeds 10 allowed). Consider refactoring.
Open

def _check_user_config_types(
    user_config: dict[str, object],
    default_values: dict[str, object],
    skipped: frozenset[str],
) -> None:
Severity: Minor
Found in pywikibot/config.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

TODO found
Open

# TODO: consider getting rid of this config variable.
Severity: Minor
Found in pywikibot/config.py by fixme

There are no issues that match your filters.

Category
Status