KarrLab/datanator

View on GitHub
datanator/data_source/array_express_tools/ensembl_tools.py

Summary

Maintainability
D
1 day
Test Coverage
F
0%

Function get_strain_info has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
Open

def get_strain_info(sample):
    """
    Get information about the refernce genome that should be used for a given sample

        Args:
Severity: Minor
Found in datanator/data_source/array_express_tools/ensembl_tools.py - About 1 day 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 get_ftp_url has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def get_ftp_url(url):
    ftp_url = None
    attempts = 0
    while attempts < 10:
        try:
Severity: Minor
Found in datanator/data_source/array_express_tools/ensembl_tools.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

Avoid deeply nested control flow statements.
Open

                    if characteristic.category.lower() == 'organism':
                        organism = characteristic.value
                    if characteristic.category.lower() in SYNONYMS_PRIORITY_LIST[i]:
Severity: Major
Found in datanator/data_source/array_express_tools/ensembl_tools.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if characteristic.category.lower() in SYNONYMS_PRIORITY_LIST[i]:
                            try:
                                strain = "{}".format(characteristic.value)
                            except UnicodeEncodeError:
                                pass
    Severity: Major
    Found in datanator/data_source/array_express_tools/ensembl_tools.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if org_name.startswith(format_org_name(try_org)):
                              kegg_org_symbol = thing.split('  ')[0]
                              url = get_ref_seq_url(kegg_org_symbol)
                              spec_name = org_name.replace("-","_").replace(" ", "_")
                              full_strain_specificity ==True
      Severity: Major
      Found in datanator/data_source/array_express_tools/ensembl_tools.py - About 45 mins to fix

        Function get_json_ends has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_json_ends(tree):
            ends = []
            nodes = [tree]
            while nodes:
                new_nodes = []
        Severity: Minor
        Found in datanator/data_source/array_express_tools/ensembl_tools.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

        There are no issues that match your filters.

        Category
        Status