Showing 158 of 214 total issues
Method drop_db
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def self.drop_db(adapter, user, password, host, database)
case adapter
when 'postgres'
environment = {}
environment['PGPASSWORD'] = password unless password.nil? || password.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 invoke_route
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def invoke_route(route, params, first_time)
@_response_buffer = nil
@route = request.route_obj = route
captured_params = captures_from_params(params)
- 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 render_like_sinatra
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def render_like_sinatra(engine, data, options={}, locals={}, &block)
# merge app-level options
engine_options = settings.respond_to?(engine) ? settings.send(engine) : {}
options = engine_options.merge(options)
- 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 dispatch!
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def dispatch!
@params = defined?(Sinatra::IndifferentHash) ? Sinatra::IndifferentHash[@request.params] : indifferent_params(@request.params)
force_encoding(@params)
invoke do
static! if settings.static? && (request.get? || request.head?)
- 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 rendering.rb
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'padrino/core_ext/output_safety'
require 'padrino-support'
require 'pathname'
module Padrino
Class Logger
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Logger
##
# Ruby (standard) logger levels:
#
# :fatal:: An not handleable error that results in a program crash
Method parse_route
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_route(path, options, verb)
path = path.dup if path.kind_of?(String)
route_options = {}
if options[:params] == true
Method create_app
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def create_app
self.destination_root = options[:root]
underscore_name = name.gsub(/\W/, '_')
@app_folder = underscore_name.underscore
@app_name = underscore_name.camelize
- 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 render
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def render(engine, file=nil, options={}, locals=nil, &block)
options.delete(:layout)
engine, file = file, engine if file.nil?
template_engine = engine ? ::Tilt[engine] : ::Tilt.default_mapping[file]
fail "Engine #{engine.inspect} is not registered with Tilt" unless template_engine
- 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 require_dependencies
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def require_dependencies(*paths)
options = { :cyclic => true }.update(paths.last.is_a?(Hash) ? paths.pop : {})
files = paths.flatten.flat_map{ |path| Dir.glob(path).sort_by{ |filename| filename.count('/') } }.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 filter_params!
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def filter_params!(params, allowed_params)
params.each do |key,value|
type = allowed_params[key]
next if value.kind_of?(Array) && type
case
- 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
Function show
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Tooltip.prototype.show = function () {
var e = $.Event('show.bs.' + this.type)
if (this.hasContent() && this.enabled) {
this.$element.trigger(e)
Method render
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def render(engine=nil, data=nil, options={}, locals={}, &block)
locals = @_locals || {} if !options[:locals] && locals.empty?
@template_cache.clear if settings.reload_templates?
engine ||= message_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 provides_format
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def provides_format(*types)
mime_types = types.map{ |type| mime_type(CONTENT_TYPE_ALIASES[type] || type) }
condition do
return provides_format?(types, params[:format].to_sym) if params[:format]
- 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 server_options
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def server_options(options)
info = []
server = Rack::Handler.get(options[:server]) || Rack::Handler.default(options)
if server && server.respond_to?(:valid_options)
- 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 route!
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def route!(base = settings, pass_block = nil)
Thread.current['padrino.instance'] = self
first_time = true
routes = base.compiled_router.call(@request) do |route, params|
- 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 create_database
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_database(config)
begin
if config[:adapter] =~ /sqlite/
if File.exist?(config[:database])
$stderr.puts "#{config[:database]} already exists."
Function slide
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Carousel.prototype.slide = function (type, next) {
var $active = this.$element.find('.item.active')
var $next = next || $active[type]()
var isCycling = this.interval
var direction = type == 'next' ? 'left' : 'right'
Method distance_of_time_in_words
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false, options = {})
from_time = from_time.to_time if from_time.respond_to?(:to_time)
to_time = to_time.to_time if to_time.respond_to?(:to_time)
distance_in_minutes = (((to_time.to_i - from_time.to_i).abs)/60).round
distance_in_seconds = ((to_time.to_i - from_time.to_i).abs).round
- 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 number_to_human_size
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def number_to_human_size(number, *args)
return nil if number.nil?
options = args.last.is_a?(Hash) ? Utils.symbolize_keys(args.pop) : {}
- 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"