pacifica/pacifica-dispatcher

View on GitHub
pacifica/dispatcher/uploader_runners.py

Summary

Maintainability
A
0 mins
Test Coverage

Function _to_meta_data has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Wontfix

def _to_meta_data(transaction: Transaction,
                  transaction_key_values: typing.List[TransactionKeyValue]) -> MetaData:
    meta_objs = []

    if transaction is not None:
Severity: Minor
Found in pacifica/dispatcher/uploader_runners.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 _should_sleep has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Wontfix

def _should_sleep(**kwargs: typing.Dict[str, typing.Any]) -> bool:  # pragma: no cover
    for name in ['state', 'task', 'task_percent']:
        if name not in kwargs:
            raise ValueError('field \'{0}\' is not defined'.format(name.replace('\'', '\\\'')))

Severity: Minor
Found in pacifica/dispatcher/uploader_runners.py - About 35 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

Avoid too many return statements within this function.
Wontfix

    return False
Severity: Major
Found in pacifica/dispatcher/uploader_runners.py - About 30 mins to fix

    There are no issues that match your filters.

    Category
    Status