Showing 206 of 227 total issues
Method remove_title
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def remove_title
lambda {|d|
if not d.first_name?
raise "No first name"
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
Class Dataset
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class Dataset < Hashie::Mash
include Npolar::Validation::MultiJsonSchemaValidator
BASE = "http://api.npolar.no/dataset/"
File placename_inspire_feed.rb
has 326 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "atom"
require "yajl"
require "uuidtools"
require "nokogiri"
require "uri"
Method feed
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.feed(response, request)
facets = {}
base = request.path.gsub(/\/$/, "")+"/"
Method handle
has a Cognitive Complexity of 25 (exceeds 5 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")
- 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_lambda
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def self.before_lambda
lambda {|request|
if ["POST", "PUT"].include? request.request_method and "application/json" == request.media_type
begin
- 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 a Cognitive Complexity of 25 (exceeds 5 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
- 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 constantize
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def self.constantize(camel_cased_word)
names = camel_cased_word.split('::')
# Trigger a builtin NameError exception including the ill-formed constant in the message.
#Object.const_get(camel_cased_word) if names.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"
Further reading
Method download
has a Cognitive Complexity of 24 (exceeds 5 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}"}]"
- 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
File dataset_doi.rb
has 308 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "date"
require "time"
require "json"
require "uri"
require "open-uri"
Method seed
has a Cognitive Complexity of 23 (exceeds 5 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|
- 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_lambda
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def self.after_lambda
lambda {|request, response|
# Location header on POST, PUT, DELETE
# @todo Absolute URI
- 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
File index.rb
has 302 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Views
module Api
class Index < Npolar::Mustache::JsonView
# Coming APIs: Tracking, Monitoring, Placenames,Ecotox
File dataset.rb
has 296 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "hashie"
require "date"
module Metadata
Method to_hash
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def to_hash
unless gcmd?
self[:gcmd]=Hashie::Mash.new
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
File dataset_migration7.rb
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "logger"
module Metadata
# Schema 1.0.0.pre
Method indexer
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def indexer
log.debug "Indexing #{service.search.engine}"
case service.search.engine
when /Solr/
lambda { |changes|
- 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_valid
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def before_valid
if activity?
activity.map {|a|
if a.start? and a.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 run
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run(really=false)
log.info "#{self.class.name}#run #{uri} [Migrations: #{migrations.size}] --really=#{really}"
log.debug "Migrations: #{migrations}"
# 1. Get (all) documents
Method unescape
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def unescape
lambda {|d|
if d.to_json =~ /\&\#x[\dA-F][\dA-F]/
d.each do |k,v|
- 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"