CIMAC-CIDC/cidc-api-gae

View on GitHub
cidc_api/shared/gcloud_client.py

Summary

Maintainability
A
25 mins
Test Coverage
C
79%

Function _build_trial_upload_prefixes has a Cognitive Complexity of 18 (exceeds 10 allowed). Consider refactoring.
Wontfix

def _build_trial_upload_prefixes(
    trial_id: Optional[str],
    upload_type: Optional[Tuple[Optional[str]]],
    session: Optional[Session] = None,
) -> Set[str]:
Severity: Minor
Found in cidc_api/shared/gcloud_client.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 _encode_and_publish has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
Open

def _encode_and_publish(content: str, topic: str) -> Future:
    """Convert `content` to bytes and publish it to `topic`."""
    pubsub_publisher = pubsub.PublisherClient()
    topic = pubsub_publisher.topic_path(GOOGLE_CLOUD_PROJECT, topic)
    data = bytes(content, "utf-8")
Severity: Minor
Found in cidc_api/shared/gcloud_client.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