Showing 227 of 227 total issues
Method hashi
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def hashi
lambda {|d|
d.title = d.title.strip
begin
Method download
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def download(destination, earliest=nil, latest=nil)
if auth.nil?
raise ArgumentError, "Please set auth -> Followit::AuthService"
end
log.debug "Starting #{auth.username} download of Followit XML to #{destination} [#{ earliest.nil? ? '': "earliest date: #{earliest.to_date}"}]"
Method handle
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle(request)
log.debug self.class.name+"#handle #{request.request_method} #{request.url}"
if storage.nil?
return http_error(501, "No storage set for API endpoint, cannot handle request")
Method fix_conference_dates
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def fix_conference_dates
lambda {|d|
if d.conference? and d.conference.dates? and d.conference.dates.any?
d.conference.dates.each_with_index do |dt,idx|
- 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 set_id_and_gcmd_shortname_for_organisations
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def set_id_and_gcmd_shortname_for_organisations
lambda {|d|
if d.organisations? and d.organisations.any?
d.organisations.select {|o| o.id.nil? or o.gcmd_short_name.nil? }.each {|o|
- 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 link_facet
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def link_facet(field, value, count)
value = value == "" ? "∅" : value
if filtered?(field,value)
- 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 changes_not_edits
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def changes_not_edits
lambda {|d|
if d.edits?
users = d.edits.map {|e| e.email }.uniq
- 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 run
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def run
buffer = []
param[:slice] = param[:slice].to_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 rename
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def rename
lambda {|d|
if not d.published? and d.published_sort?
#log.warn d.published_helper
if d.published_sort.nil?
- 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 a Cognitive Complexity of 15 (exceeds 5 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}",
- 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 seed
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.seed(filename_xml="/mnt/public/Datasets/Skipsregister/xml/Skip.xml")
nori = Nori.new
dataroot = nori.parse(File.read(filename_xml))["dataroot"]
dataroot["Skip"].map {|v|
Method data_center
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def data_center
data_center = (organisations||[]).reject {|o| not o.gcmd_short_name or o.gcmd_short_name.to_s == "" }.select {|o|
o.roles.include?("owner") or o.roles.include?("resourceProvider") or o.roles.include?("publisher")
}.map {|o|
Method indexer
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def indexer
log.debug "Indexing #{service.search.engine}"
case service.search.engine
when /Solr/
lambda { |changes|
Method GeoJSON
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def GeoJSON(opts={ })
features = parse
features = features.select {|m|
Method related_url
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def related_url
typer = lambda {|type| case type
when "dataset", "data"
"GET DATA"
Method locations_as_object
has 44 lines of code (exceeds 25 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
Method before_save
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def before_save(request=nil)
username = request.nil? ? "anonymous" : request.username
self[:collection] = "dataset"
Method force_country
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def force_country
lambda {|d|
if d.locations? and d.locations.any?
d.locations.each do |l|
if l.country.nil? or l.country.to_s == ""
- 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
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def post(data, params={})
#unless valid? data
# raise Exception
#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 add_past_edits
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def add_past_edits
lambda {|d|
- 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"