Showing 206 of 227 total issues
Method feed
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def self.feed(response, request)
facets = {}
base = request.path.gsub(/\/$/, "")+"/"
- 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 xml_from_json
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def xml_from_json(request)
response = app.call(request.env)
if response.status < 300
- 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 before_save
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def before_save(request=nil)
username = request.nil? ? "anonymous" : request.username
self[:collection] = "dataset"
- 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 kernel
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.kernel(dataset,doi)
publicationYear = (!dataset.released.nil? and dataset.released =~ /^\d{4}-/) ? dataset.released.split("-").first : dataset.created.split("-").first
publisher = (dataset.organisations||[]).select {|o| o.roles.include? "publisher"}.map {|p| p.id||p.name }.join(", ")
creators = (dataset.people||[]).select {|p| p.roles.include? "author"}.map {|p| {
creatorName: "#{p.last_name}, #{p.first_name}",
Method to_hash
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_hash
unless gcmd?
self[:gcmd]=Hashie::Mash.new
end
Method find
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
def find(selector, options={})
if :all == selector
storage.param = {"include_docs" => true}
Method geojson_feature_collection
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def self.geojson_feature_collection(response,request, lat_field="latitude", long_field="longitude", geometry="Point")
if not ["Point", "LineString"].include? geometry
raise ArgumentError, "Unsupported GeoJSON geometry type: #{geometry}"
end
feed = feed(response, request)["feed"].reject {|k,v| k =~ /^entries/}
- 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 new_sets
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def new_sets
lambda {|d|
if d.sets?
if d.sets.any? {|set| set =~ /^(nmdc|gcmd|ipy)$/ui }
d.sets = d.sets.reject {|set| set =~ /dokipy/ui }
- 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 activity
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def activity
periods = []
object.Temporal_Coverage.each do | period |
start = ""
- 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 atom_entry
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def atom_entry(metadata_dataset)
dataset = dataset = Metadata::Dataset.new(metadata_dataset)
entry = ::Atom::Entry.new do |e|
e.id = dataset.id =~ /^\w{8}[-]\w{4}-\w{4}-\w{4}-\w{12}$/ ? "urn:uuid:#{dataset.id}" : dataset.id
Method fq
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fq
# config[:fq] should contain a lambda that will extract fq from a request
if config[:fq].respond_to?(:call)
config_fq = config[:fq].call(request)
Method atom_feed
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
def atom_feed
atom_entries = @json_feed[:entries].map {|placename|
atom_entry(placename)
}
Method parse_preamble
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def parse_preamble(input, map=PREAMBLE_KEY_MAP)
@headers_row = nil
h = { preamble: {}}
- 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 doi
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def doi
lambda {|d|
doi = self.class.doi(d) # remember: a different doi may be registered for various reasons, see line #240
dataset_is_updated_after_doi = false
Method locations_as_object
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def locations_as_object
lambda {|d|
if d.locations? and d.locations.any? and d.locations.all? {|l| l.is_a? String }
log.info d.title.to_json
- 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 related_url
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def related_url
typer = lambda {|type| case type
when "dataset", "data"
"GET DATA"
- 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 data_set_citation
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def data_set_citation
if gcmd.citation? and gcmd.citation.any?
return gcmd.citation
end
- 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 post_many
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def post_many(data, params={})
if data !~ JSON_ARRAY_REGEX
raise ArgumentException, "Please provide data as JSON Array"
end
t0 = Time.now
Method location_fixer
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def location_fixer(locations)
fixed = []
fixed += locations.select {|l| l=~ /Svalbard/ui }.map {|l|
placename = l.split("-").last.strip
Method location
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def location
location = gcmd.locations? ? gcmd.locations : []
polar = {"Location_Category" => "GEOGRAPHIC REGION", "Location_Type" => "POLAR"}
arctic = {"Location_Category" => "GEOGRAPHIC REGION", "Location_Type" => "ARCTIC"}