KarrLab/datanator

View on GitHub
datanator/data_source/process_rna_seq/core.py

Summary

Maintainability
B
5 hrs
Test Coverage
F
0%

Function download_cdna has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def download_cdna(ref_genome, strain_name, url, temp_directory):
    CDNA_DIR = "{}/CDNA_FILES".format(temp_directory)
    if not os.path.isdir(CDNA_DIR):
        os.makedirs(CDNA_DIR)
    file_name = "{}/{}.cdna.all.fa.gz".format(CDNA_DIR, strain_name)
Severity: Minor
Found in datanator/data_source/process_rna_seq/core.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 download_fastq has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def download_fastq(experiment_name,  sample_name, temp_directory, fastq_urls):
    FASTQ_DIR = "{}/FASTQ_FILES".format(temp_directory)
    if not os.path.isdir(FASTQ_DIR):
        os.makedirs(FASTQ_DIR)
    for num, url in enumerate(fastq_urls.split(" ")):
Severity: Minor
Found in datanator/data_source/process_rna_seq/core.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 process_fastq has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def process_fastq(experiment_name, sample_name, strain_name, num_fastq_files, read_type, output_directory, temp_directory):
Severity: Major
Found in datanator/data_source/process_rna_seq/core.py - About 50 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if locus_tag in list_locus_tags:
                            locus_tag = "{}_variation".format(locus_tag)
                        list_locus_tags.append(locus_tag)
    Severity: Major
    Found in datanator/data_source/process_rna_seq/core.py - About 45 mins to fix

      Function get_processed_data_samples has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_processed_data_samples(samples, output_directory, temp_directory):
          for sample in samples:
              if sample.ensembl_info and sample.fastq_urls:
                  download_cdna(sample.ensembl_info[0].ref_genome, sample.ensembl_info[0].organism_strain, sample.ensembl_info[0].url, temp_directory)
                  fastq_urls = ""
      Severity: Minor
      Found in datanator/data_source/process_rna_seq/core.py - About 45 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

      Function process_fastq has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def process_fastq(experiment_name, sample_name, strain_name, num_fastq_files, read_type, output_directory, temp_directory):
      
          exp_dirname = "{}/{}".format(output_directory, experiment_name)
          if not os.path.isdir(exp_dirname):
              os.makedirs(exp_dirname)
      Severity: Minor
      Found in datanator/data_source/process_rna_seq/core.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