SpeciesFileGroup/taxonworks

View on GitHub

Showing 739 of 12,579 total issues

Method bibliography has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def self.bibliography(sources)
      b = BibTeX::Bibliography.new
      sources.each do |s|
        next unless s.is_bibtex?
        e = s.to_bibtex
Severity: Minor
Found in lib/vendor/bibtex_ruby.rb - 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

Method soft_validators has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def soft_validators(only_sets: [], except_sets: [], only_methods: [], except_methods: [], include_flagged: false, fixable: nil, include_superclass: true)
      only_methods = Utilities::Params.arrayify(only_methods)
      return only_methods if !only_methods.empty?

      except_methods = Utilities::Params.arrayify(except_methods)
Severity: Minor
Found in lib/soft_validation.rb - 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

Method is_unambiguous? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def is_unambiguous?
        RANKS.each do |r|
          if !send(r).nil?
            return false unless !send(r).nil? && !unambiguous_at?(r).nil?
          end
Severity: Minor
Found in lib/vendor/biodiversity.rb - 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

Method symbolize_keys has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.symbolize_keys(hash)
    hash.inject({}) do |h, (k, v)|
      h[k.is_a?(String) ? k.to_sym : k] = (v.is_a?(Hash) ? symbolize_keys(v) : v)
      h
    end
Severity: Minor
Found in lib/utilities/hashes.rb - 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

Method normalize_and_order_dates has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.normalize_and_order_dates(start_date, end_date)
    if start_date.blank? && end_date.blank? # set entire range
      [ EARLIEST_DATE, today] # 1700-01-01 - Today
    else
      end_date = start_date if end_date.blank?
Severity: Minor
Found in lib/utilities/dates.rb - 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

Method process_result has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def process_result(use_thumbnail: true)
      begin
        sqed.use_thumbnail = use_thumbnail
        r = sqed.result
      rescue Sqed::Error
Severity: Minor
Found in lib/vendor/sqed_to_taxonworks.rb - 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

Method any_global_id_facet has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def any_global_id_facet
        return nil if any_global_id.empty?
        a = matching_global_id(:subject, any_global_id)
        b = matching_global_id(:object, any_global_id)
        if a && b
Severity: Minor
Found in lib/queries/biological_association/filter.rb - 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

Method load_selenium_config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.load_selenium_config(settings)
    invalid = settings.keys - [:browser, :marionette, :firefox_binary_path, :chromedriver_path, :headless]

    raise Error, "#{invalid} are not valid settings for test:selenium." unless invalid.empty?
    raise Error, "Can not find Firefox browser binary #{settings[:firefox_binary_path]}." if settings[:browser] == :firefox && !settings[:firefox_binary_path].blank? && !File.exist?(settings[:firefox_binary_path])
Severity: Minor
Found in lib/settings.rb - 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

Method replace has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.replace(original_file, new_file)
    return false unless File.exist?(original_file) && File.exist?(new_file)
    fo = original_file
    ft = fo + '.tmp'

Severity: Minor
Found in lib/utilities/files.rb - 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

Method all_citations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def all_citations
      c  = items.collect{|i| i.citation}

      if !object.nil?
        relationship_items.each do |i|
Severity: Minor
Found in lib/catalog/nomenclature/entry.rb - 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

Method depiction has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def depiction
      if @depiction
        @depiction
      else
        begin
Severity: Minor
Found in lib/vendor/sqed_to_taxonworks.rb - 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

Method disambiguate_combination has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def disambiguate_combination(target_protonym_ids = {})
        return nil unless target_protonym_ids.any?
        c = combination
        b = ambiguous_ranks

Severity: Minor
Found in lib/vendor/biodiversity.rb - 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

Method build has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def build
      v = object.valid_taxon_name
      base_names = v.historical_taxon_names

      base_names.each do |t|
Severity: Minor
Found in lib/catalog/nomenclature/entry.rb - 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

Method all_sources has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def all_sources
      s  = items.collect{|i| i.source}
      if !object.nil?
        relationship_items.each do |i|
          s << i.object.object_taxon_name.origin_citation.try(:source) if i.object.subject_taxon_name != object  # base_object?
Severity: Minor
Found in lib/catalog/nomenclature/entry.rb - 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

Method probable_source_of_text has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def probable_source_of_text
        case score
        when 3..23
          if client.language == 'eng'
            'original text'
Severity: Minor
Found in lib/vendor/gnfinder/result.rb - 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

Method initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize(object: nil, type: nil, start_date: nil, end_date: nil)
    raise TaxonWorks::Error, ':object is nil' if object.nil?
    raise TaxonWorks::Error, ':type is nil' if type.nil?
    raise TaxonWorks::Error, 'type is not in the list' if !Catalog::CollectionObject::EVENT_TYPES.include?(type)
    raise TaxonWorks::Error, 'start_date is not a Time' if start_date && !start_date.kind_of?(Time)
Severity: Minor
Found in lib/catalog/collection_object/entry_item.rb - 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

Method nomenclature_date has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.nomenclature_date(day = nil, month = nil, year = nil)
    if year.nil?
      nil
    elsif month.nil?
      Time.utc(year.to_i, 12, 31)
Severity: Minor
Found in lib/utilities/dates.rb - 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

Method fix_2_digit_year has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def self.fix_2_digit_year(year)
    if year.length < 4
      year = year.gsub("'", '')
      if year.length < 3
        tny = Time.now.year
Severity: Minor
Found in lib/utilities/dates.rb - 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

Avoid too many return statements within this function.
Open

    return makeFreeTextObservation(observationData)

    Avoid too many return statements within this function.
    Open

        return makeFreeTextObservation(observationData)
      Severity
      Category
      Status
      Source
      Language