genome/dgi-db

View on GitHub

Showing 122 of 193 total issues

Avoid too many return statements within this method.
Open

                return records_with_highest_max_phase.first
Severity: Major
Found in lib/genome/groupers/drug_grouper.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                      return nil
    Severity: Major
    Found in lib/genome/groupers/drug_grouper.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                          return get_normalized_record_or_drug_for_chembl_id(get_min_chembl_id(chembl_ids_for_records(records_with_trade_name)))
      Severity: Major
      Found in lib/genome/groupers/drug_grouper.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                      return nil
        Severity: Major
        Found in lib/genome/groupers/drug_grouper.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return get_normalized_record_or_drug_for_chembl_id(get_min_chembl_id(chembl_ids_for_records(records_with_highest_max_phase)))
          Severity: Major
          Found in lib/genome/groupers/drug_grouper.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                                return records_with_trade_name.first
            Severity: Major
            Found in lib/genome/groupers/drug_grouper.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                  return get_normalized_record_or_drug_for_chembl_id(get_min_chembl_id(chembl_ids_for_records(records_with_highest_max_phase)))
              Severity: Major
              Found in lib/genome/groupers/drug_grouper.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return nil
                Severity: Major
                Found in lib/genome/groupers/gene_grouper.rb - About 30 mins to fix

                  Method attribute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def self.attribute(name, type = String, opts = {})
                          unless type == String || type == Array
                            raise 'Sorry, only string and array types are supported'
                          end
                  
                  
                  Severity: Minor
                  Found in lib/genome/importers/delimited_row.rb - 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

                  Method make_get_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.make_get_request(url)
                      retries = 0
                      begin
                        uri = URI(url)
                        res = Net::HTTP.get_response(uri)
                  Severity: Minor
                  Found in lib/utils/pmid.rb - 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

                  Method import! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def import!
                            File.open(@tsv_path).each_with_index do |line, index|
                              next if (line.blank? || index == 0)
                              process_row(EntrezGenePathwayRow.new(line))
                              if index % 10_000 == 0
                  Severity: Minor
                  Found in lib/genome/importers/entrez/entrez_gene_pathway_importer.rb - 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

                  Method chembl_ids_for_records has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def chembl_ids_for_records(records)
                          chembl_ids = records.each_with_object([]) do |r, ids|
                            if r['concept_identifier'].start_with?('chembl:') && valid_chembl_id?(r['concept_identifier'])
                              ids << r['concept_identifier']
                            end
                  Severity: Minor
                  Found in lib/genome/groupers/drug_grouper.rb - 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

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

                      def create_request(self):
                          self.request = "https://dgidb.org/api/v1/interactions.json?genes=FLT1&drug_types=antineoplastic&interaction_sources=TALC"
                          self.payload = {}
                          if(self.genes):
                              self.payload['genes'] = self.genes
                  Severity: Minor
                  Found in files/python_example.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

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

                      def write_log(self):
                          self.load_versions()
                          if self.append:
                              today = datetime.date.today().strftime("%d-%B-%Y")
                              if self.version is not None:
                  Severity: Minor
                  Found in lib/genome/updaters/version_logger.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

                  Method create_gene_claims has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def create_gene_claims
                        CSV.foreach(file_path, :headers => true, :col_sep => "\t") do |row|
                          gene_claim = create_gene_claim(row["Gene"], 'Gene Symbol')
                          create_gene_claim_alias(gene_claim, row["Ensembl"], 'Ensembl Gene ID')
                          unless row['Gene synonym'].nil?
                  Severity: Minor
                  Found in lib/genome/importers/human_protein_atlas/human_protein_atlas.rb - 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

                  Method create_entity has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def create_entity(property_type, val, opts)
                            if !opts[:unless].call(val)
                              if property_type == :alias
                                @importer.send("create_#{@type}_alias", "#{@type}_id".to_sym => @id, alias: val, nomenclature: opts[:nomenclature])
                              elsif property_type == :attribute
                  Severity: Minor
                  Found in lib/genome/importers/dsl/node.rb - 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

                  Method group_gene_claim has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def group_gene_claim(gene_claim)
                          if (gene = DataModel::Gene.where('upper(name) = ? or upper(long_name) = ?', gene_claim.name.upcase, gene_claim.name.upcase)).one?
                            add_gene_claim_to_gene(gene_claim, gene.first)
                            return gene_claim
                          end
                  Severity: Minor
                  Found in lib/genome/groupers/gene_grouper.rb - 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

                  Method create_gene_claims has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def create_gene_claims
                        CSV.foreach(file_path, :headers => true, :col_sep => "\t") do |row|
                          if row['tax_id'] == '9606'
                            gene_claim = create_gene_claim(row['Symbol'], 'Gene Symbol')
                            create_gene_claim_alias(gene_claim, row['GeneID'], 'Gene ID')
                  Severity: Minor
                  Found in lib/genome/importers/d_gene/dgene.rb - 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

                  Method links has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def links
                      {}.tap do |links|
                        links['next'] = if items.last_page?
                                          nil
                                        else
                  Severity: Minor
                  Found in app/presenters/pagination_presenter.rb - 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

                  Method create_gene_claim_for_entry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def create_gene_claim_for_entry(gene, category)
                        gene_claim = create_gene_claim(gene['bioentity_label'], 'Gene Symbol')
                        unless gene['synonym'].nil?
                          gene['synonym'].each do |synonym|
                            if synonym.include? 'UniProtKB:'
                  Severity: Minor
                  Found in lib/genome/online_updaters/go/updater.rb - 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