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",
"http://rs.tdwg.org/dwc/terms/kingdom",
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"
- Read upRead up
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)
- Read upRead up
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)
- Read upRead up
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|
- Read upRead up
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
- Read upRead up
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|
- Read upRead up
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",
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",
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,
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|
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
- Read upRead up
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 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|
- Read upRead up
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")
- Read upRead up
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)
- Read upRead up
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|
- Read upRead up
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("")
- Read upRead up
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
- Read upRead up
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|
- Read upRead up
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?
- Read upRead up
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"