genome/dgi-db

View on GitHub
lib/genome/importers/guide_to_pharmacology/guide_to_pharmacology.rb

Summary

Maintainability
C
1 day
Test Coverage

Method import_claims has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

    def import_claims
      CSV.foreach(gene_file_path, :headers => true) do |line|
        gene_name = line['Human Entrez Gene']
        next if blank?(gene_name)

Severity: Minor
Found in lib/genome/importers/guide_to_pharmacology/guide_to_pharmacology.rb - About 5 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

Method import_claims has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def import_claims
      CSV.foreach(gene_file_path, :headers => true) do |line|
        gene_name = line['Human Entrez Gene']
        next if blank?(gene_name)

Severity: Major
Found in lib/genome/importers/guide_to_pharmacology/guide_to_pharmacology.rb - About 2 hrs to fix

    Method create_gene_claim_aliases has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def create_gene_claim_aliases (gene_claim, line)
          create_gene_claim_alias(gene_claim, line['target'], 'GuideToPharmacology Name') unless blank?(line['target'])
          unless blank?(line['target_ensembl_gene_id'])
            line['target_ensembl_gene_id'].split('|').each do |ensembl_id|
              create_gene_claim_alias(gene_claim, ensembl_id, 'Ensembl ID')
    Severity: Minor
    Found in lib/genome/importers/guide_to_pharmacology/guide_to_pharmacology.rb - 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

    There are no issues that match your filters.

    Category
    Status