GlobalNamesArchitecture/dwca-hunter

View on GitHub

Showing 91 of 144 total issues

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

    def init_classification_path(items)
      # ignore non-template links
      items["taxonavigation"]&.each do |line|
        line.gsub!(/\[\[.*\]\]/, "") # ignore non-template links
        next unless template_link = line.match(@re[:template_link])
Severity: Minor
Found in lib/dwca_hunter/resources/wikispecies.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

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

    def get_vern_name(n)
      sci_name_id = nil
      apps = nil
      concepts = n["concepts"]
      if !concepts.nil?
Severity: Minor
Found in lib/dwca_hunter/resources/nzor.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

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

    def collect_names
      @names_index = {}
      file = CSV.open(File.join(@download_dir, "data.csv"),
                      headers: true)
      file.each_with_index do |row, i|
Severity: Minor
Found in lib/dwca_hunter/resources/mycobank.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

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

    def organize_data
      DwcaHunter::logger_write(self.object_id,
                               "Organizing data")
      File.readlines(@download_path).each_with_index do |l, idx|
        l_obj = JSON.parse(l)
Severity: Minor
Found in lib/dwca_hunter/resources/nzor.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

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

    def download
      f = File.open(@download_path, 'w:utf-8')
      headers = { accept: :json}
      i = 0
      while
Severity: Minor
Found in lib/dwca_hunter/resources/nzor.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

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

    def get_names
      # 0    tsn serial not null
      # 1    unit_ind1 char(1)
      # 2    unit_name1 char(35) not null
      # 3    unit_ind2 char(1)
Severity: Minor
Found in lib/dwca_hunter/resources/itis.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_template has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def process_template(x)
      name = page_title(x).gsub!(@re[:template], "").strip
      text = x.xpath("//text").text.strip
      parent_name = text.match(@re[:template_link])
      if parent_name
Severity: Minor
Found in lib/dwca_hunter/resources/wikispecies.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 classification has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def classification(str)
      kingdom = phylum = klass = order = family = genus = ""
      return [kingdom, phylum, klass, order, family, genus] if str.nil?

      el = str.split("|").map(&:strip)
Severity: Minor
Found in lib/dwca_hunter/resources/fungal_names.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 collect_names has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def collect_names
      @names_index = {}
      file = CSV.open(File.join(@download_dir, "data.csv"),
                      headers: true)
      file.each_with_index do |row, _i|
Severity: Minor
Found in lib/dwca_hunter/resources/aos-birds.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 real_name? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def real_name?(str)
      parsed = @parser.parse(str)
      return false unless parsed[:parsed]
      epithets = parsed[:canonicalName][:simple].split(" ")[1..-1]
      return false if epithets.nil? || epithets.empty?
Severity: Minor
Found in lib/dwca_hunter/resources/mammal_species.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 run_query has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def run_query(q)
      count = 0
      requests_num = 0
      loop do
        freebase_url = "http://api.freebase.com/api/service/mqlread?query=%s" %
Severity: Minor
Found in lib/dwca_hunter/resources/freebase.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