GlobalNamesArchitecture/dwca-hunter

View on GitHub

Showing 91 of 144 total issues

Method generate_dwca has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def generate_dwca
      DwcaHunter.logger_write(object_id,
                              "Creating DarwinCore Archive file")
      @core = [["http://rs.tdwg.org/dwc/terms/taxonID",
                "http://rs.tdwg.org/dwc/terms/scientificName",
Severity: Minor
Found in lib/dwca_hunter/resources/mycobank.rb - About 1 hr to fix

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

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

    Method process_synonyms has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def process_synonyms(rec, taxon)
          accepted_id = taxon[0]
          parent_id = taxon[2]
          rank = taxon[-1]
          return unless %w[species subspecies].include? rank
    Severity: Minor
    Found in lib/dwca_hunter/resources/mammal_species.rb - 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

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

        def collect_names
          tpt_dir = "tpt-taxonomy-main"
          tpt_path = File.join(@download_dir, tpt_dir)
          @names_index = {}
          files = Dir.entries(tpt_path)
    Severity: Minor
    Found in lib/dwca_hunter/resources/tpt.rb - 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

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

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

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

        def collect_names
          @names_index = {}
          file = CSV.open(File.join(@download_dir, find_csv_file),
                          headers: true)
          file.each do |row|
    Severity: Minor
    Found in lib/dwca_hunter/resources/mammal_divdb.rb - 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

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

        def get_names
          puts "Processing names"
          file = CSV.open(@download_path, headers: true)
    
          file.each_with_index do |row, i|
    Severity: Minor
    Found in lib/dwca_hunter/resources/lpsn_bacteria.rb - 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

    Method generate_dwca has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def generate_dwca
          DwcaHunter.logger_write(object_id,
                                  "Creating DarwinCore Archive file")
          @core = [["http://rs.tdwg.org/dwc/terms/taxonID",
                    "http://rs.tdwg.org/dwc/terms/scientificName",
    Severity: Minor
    Found in lib/dwca_hunter/resources/wikidata.rb - About 1 hr to fix

      Method generate_dwca has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def generate_dwca
            DwcaHunter.logger_write(object_id,
                                    "Creating DarwinCore Archive file")
            @core = [["http://rs.tdwg.org/dwc/terms/taxonID",
                      "http://rs.tdwg.org/dwc/terms/scientificName",
      Severity: Minor
      Found in lib/dwca_hunter/resources/sherborn.rb - About 1 hr to fix

        Method collect_names has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def collect_names
              @names_index = {}
              file = CSV.open(File.join(@download_dir, "taxonomy_export_2023Mar6.csv"),
                              headers: true)
              file.each_with_index do |row, i|
        Severity: Minor
        Found in lib/dwca_hunter/resources/mcz.rb - About 1 hr to fix

          Method get_classification has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def get_classification(cl)
                res = {
                  kingdom: nil,
                  phylum: nil,
                  klass: nil,
          Severity: Minor
          Found in lib/dwca_hunter/resources/nzor.rb - About 1 hr to fix

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

                def collect_names
                  @names_index = {}
                  file = CSV.open(File.join(@download_dir, find_csv_file),
                    headers: true)
                  file.each do |row|
            Severity: Minor
            Found in lib/dwca_hunter/resources/disc_life_bees.rb - About 55 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 rank has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def rank(name_string) 
                  res = ""
                  parsed = @parser.parse(name_string)
                  if parsed[:parsed]
                    if parsed[:cardinality] == 2
            Severity: Minor
            Found in lib/dwca_hunter/resources/algaebase.rb - About 55 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 rank has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def rank(name_string)
                  res = ""
                  parsed = @parser.parse(name_string)
                  if parsed[:parsed]
                    return "species" if parsed[:cardinality] == 2
            Severity: Minor
            Found in lib/dwca_hunter/resources/wcvp.rb - About 55 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 remove_header_text has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def remove_header_text
                  URLS.each do |k, _v|
                    file_name = k.to_s + ".csv"
                    fout = File.open(File.join(@download_dir, file_name),
                                     "w:utf-8")
            Severity: Minor
            Found in lib/dwca_hunter/resources/paleobiodb.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def download
                  raise "#{@source_url} is not accessible" unless @url.valid?
                  f = open(@file_path,'wb')
                  count = 0
                  @url.net_http.request_get(@url.path) do |r|
            Severity: Minor
            Found in lib/dwca_hunter/downloader.rb - About 55 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_vernacular_names has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_vernacular_names(items)
                  vern = items["{{int:vernacular names}}"]
                  return unless vern.is_a?(Array) && vern.size.positive?
            
                  vn_string = vern.join("")
            Severity: Minor
            Found in lib/dwca_hunter/resources/wikispecies.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def classification(data, row)
                  data = {}
                  stack = [[data, row]]
                  until stack.empty?
                    data, row = stack.delete_at(0)
            Severity: Minor
            Found in lib/dwca_hunter/resources/paleobiodb.rb - About 55 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 move_initials has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def move_initials(ary)
                  res = []
                  ary.each do |a|
                    if res.empty?
                      res << a
            Severity: Minor
            Found in lib/dwca_hunter.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 details has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def details(row)
                row = strip row
                ref = "#{row['pubtitle']}"
                ref << " #{row['pubno']}" unless row['pubno'].empty?
                ref << ": #{row['firstpage']}" unless row['firstpage'].empty?
            Severity: Minor
            Found in lib/dwca_hunter/resources/paleodb_harvester.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

            Severity
            Category
            Status
            Source
            Language