OpenHumans/oh-23andme-source

View on GitHub

Showing 3 of 3 total issues

Function vcf_from_raw_23andme has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

def vcf_from_raw_23andme(raw_23andme):
    output = StringIO()

    reference = read_reference(REF_23ANDME_FILE)

Severity: Minor
Found in main/celery.py - About 3 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 clean_raw_23andme has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def clean_raw_23andme(closed_input_file):
    input_file = open_archive(closed_input_file)

    output = StringIO()

Severity: Minor
Found in main/celery.py - About 2 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 open_archive has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def open_archive(input_file):
    error_message = ("Input file is expected to be either '.txt', "
                     "'.gz', '.bz2', or a single '.txt' file in a "
                     "'.zip' ZIP archive.")
    if input_file.name.endswith('.zip'):
Severity: Minor
Found in main/celery_helper.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

Severity
Category
Status
Source
Language