Showing 206 of 227 total issues
Method initialize
has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring. Open
def initialize(api, config={})
@config = Hashie::Mash.new(config)
@app = ::Rack::Builder.new do
map "/" do
- 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 fq
has a Cognitive Complexity of 76 (exceeds 5 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)
- 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 dif_transformer.rb
has 529 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "hashie"
require "uuidtools"
require "uri"
require "gcmd"
File dif_hashifier.rb
has 517 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "uri"
module Metadata
# GCMD [DIF Hash](https://github.com/npolar/gcmd/blob/master/lib/gcmd/dif.rb) from [Npolar API dataset](http://api.npolar.no/schema/dataset)
Class DifTransformer
has 56 methods (exceeds 20 allowed). Consider refactoring. Open
class DifTransformer
include ::Npolar::Api
BASE = "http://api.npolar.no/dataset/"
Method doi
has a Cognitive Complexity of 47 (exceeds 5 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
- 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 Index
has 51 methods (exceeds 20 allowed). Consider refactoring. Open
class Index < Npolar::Mustache::JsonView
# Coming APIs: Tracking, Monitoring, Placenames,Ecotox
def initialize(app=nil, hash={})
File couch.rb
has 417 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "rack/client"
module Npolar
module Storage
File solrizer.rb
has 411 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "time"
module Npolar
module Rack
Method hashi
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def hashi
lambda {|d|
d.title = d.title.strip
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 run
has a Cognitive Complexity of 34 (exceeds 5 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
- 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 find
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def find(selector, options={})
if :all == selector
storage.param = {"include_docs" => 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
Class Solrizer
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
class Solrizer < Npolar::Rack::Middleware
YEAR_REGEX = /^([-])?\d{4,}/
DATE_REGEX = /(-)?(\d{4,})-(0[1-9]|1[0-2])-([12]\d|0[1-9]|3[01])/
ISODATE_REGEX = /^#{DATE_REGEX}$/
Class DifHashifier
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
class DifHashifier < Hashie::Mash
# Map [topics](http://api.npolar.no/schema/npolar_topic)to DIF Parameters (Science Keywords)
# DIF Parameters: http://api.npolar.no/gcmd/concept/?q=&filter-concept=sciencekeywords
# The main trouble is that 3 levels (down to Topic) are required by DIF - impossible for just "biology"/"geology"/"atmosphere"
Class Couch
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class Couch
# Delegate validation to model
#extend Forwardable # http://www.ruby-doc.org/stdlib-1.9.3/libdoc/forwardable/rdoc/Forwardable.html
#def_delegators :model, :valid?
Method edit
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def edit(request, response)
if not config[:edit].nil?
return config[:edit].call(edit)
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 call
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def call(env)
request = Npolar::Rack::Request.new(env)
if "json" == request.format
if request["q"].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 decode_sensor_data
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def decode_sensor_data
# For Argos data data prior to 2014-03-01 (DS/DIAG data) the sensor data may either integer or hex
# Argos data from 2014-03-01 and onwards (XML from SOAP web service) contain both integer and hex data,
# as well as platform_model string
- 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 initialize
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(api, config={})
@config = Hashie::Mash.new(config)
@app = ::Rack::Builder.new do
map "/" do
Method edit
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
def edit(request, response)
if not config[:edit].nil?
return config[:edit].call(edit)
end