Showing 206 of 227 total issues
Method simple_fixes
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def simple_fixes
lambda {|d|
d.schema = "http://api.npolar.no/schema/publication-1.0-rc4"
unless d.publication_lang?
- 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 add_edit_and_alternate_links
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def add_edit_and_alternate_links
api = ENV["NPOLAR_API"] ||= "https://api.npolar.no"
self[:links] = links||[]
- 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 to_solr
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.to_solr
lambda {|doc| # Hash with symbolized keys
# Force workspace/collection
doc[:workspace] = "biology"
- 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 gn_named_place
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def gn_named_place(placename)
id = uuid(placename[:ident]) # @todo check if placename id is uuid or uri
latitude = placename[:latitude] || placename[:north] || 0.0
longitude = placename[:longitude] || placename[:east] || 0.0
Method gn_name
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def gn_name(placename)
# gn:name
name = node "gn:name"
# gn:GeographicalNames
Method links
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def links
links = []
# 1. Related_URL
if dif.Related_URL?
Method domain_name_from_name
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def domain_name_from_name(name)
case name.strip
when "University of Innsbruck, Institute of Meteorology and Geophysics"
"imgi.uibk.ac.at"
Method remove_title
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def remove_title
lambda {|d|
if not d.first_name?
raise "No first name"
end
Method post_many
has a Cognitive Complexity of 13 (exceeds 5 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
- 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_feed_builder
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def atom_feed_builder(feed)
feed_builder = Atom::Feed.new do |f|
f.title = "Norwegian Polar Data #{request["q"]}"
f.links << Atom::Link.new(:href => request.url, :rel => "self")
f.links << Atom::Link.new(:href => "NEXT", :rel => "next")
- 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 a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def doi
lambda {|d|
if d.links? and not d.doi
dois = d.links.select {|l| l["rel"] =~ /doi/i }
if dois.any?
- 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_link
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def data_link
lambda {|d|
if not d.links?
d.links = []
- 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 gn_name
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def gn_name(placename)
# gn:name
name = node "gn:name"
# gn:GeographicalNames
- 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 parse
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def parse(data)
# convert to utf-8
data_utf8 = data.encode('UTF-8', :invalid => :replace, :replace => "")
- 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 fix_changes
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def fix_changes
lambda {|d|
if idx = @@changes.index {|a| a.any? {|c| c.key? "id" and c["id"] == d.id } }
d[:changes] = @@changes[idx].map {|c|
{ email: c["email"], name: c["name"], datetime: c["datetime"], comment: c["comment"] }
- 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 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def xml_from_json(request)
response = app.call(request.env)
if response.status < 300
Method atom_entry
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def atom_entry(placename)
placename = Hashie::Mash.new(placename) #Placename.new(placename)
entry = ::Atom::Entry.new do |e|
uuid = placename.id =~ /^\w{8}[-]\w{4}-\w{4}-\w{4}-\w{12}$/ ? placename.id : uuid(placename.ident)
e.id = "http://api.npolar.no/placename/#{uuid}"
- 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 handle_search
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def handle_search(request)
log.debug self.class.name+"#handle_search #{uri} #{solr_params}"
begin
#fq_bbox = []
- 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 after
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def after(request, response)
# Force response to Rack::Response
if response.is_a? Rack::Response
headers = response.headers
- 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 links
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def links
links = []
# 1. Related_URL
if dif.Related_URL?
- 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"