Showing 157 of 213 total issues
File routing.rb
has 517 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'padrino-support'
require 'padrino-core/path_router' unless defined?(PathRouter)
require 'padrino-core/ext/sinatra'
require 'padrino-core/filter'
Method parse_route
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
def parse_route(path, options, verb)
path = path.dup if path.kind_of?(String)
route_options = {}
if options[:params] == 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
Method route
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
def route(verb, path, *args, &block)
options = case args.size
when 2
args.last.merge(:map => args.first)
when 1
- 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 a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
def create_database(config)
begin
if config[:adapter] =~ /sqlite/
if File.exist?(config[:database])
$stderr.puts "#{config[:database]} already exists."
- 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 AbstractFormBuilder
has 48 methods (exceeds 20 allowed). Consider refactoring. Open
class AbstractFormBuilder
attr_accessor :template, :object, :multipart
attr_reader :namespace, :is_nested, :parent_form, :nested_index, :attributes_name, :model_name
def initialize(template, object, options={})
Method create_admin
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
def create_admin
self.destination_root = options[:root]
if in_app_root?
unless supported_orm.include?(orm)
say "<= At the moment, Padrino only supports #{supported_orm.join(" or ")}. Sorry!", :yellow
- 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 activerecord.rb
has 396 lines of code (exceeds 250 allowed). Consider refactoring. Open
if PadrinoTasks.load?(:activerecord, defined?(ActiveRecord))
# Fixes for Yardoc YRI Building
begin
require 'active_record'
require 'active_record/schema'
Method call
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def call(env)
began_at = Time.now
path_info = env["PATH_INFO"].to_s
script_name = env['SCRIPT_NAME']
http_host = env['HTTP_HOST']
- 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_controller
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def create_controller
validate_namespace name
self.destination_root = options[:root]
if in_app_root?
app = options[:app]
- 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_admin
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_admin
self.destination_root = options[:root]
if in_app_root?
unless supported_orm.include?(orm)
say "<= At the moment, Padrino only supports #{supported_orm.join(" or ")}. Sorry!", :yellow
Method setup_components
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def setup_components
self.destination_root = options[:root]
if in_app_root?
@_components = options.class.new options.select{ |key,_| self.class.component_types.include?(key.to_sym) }
@app_name = (options[:app] || "App").gsub(/\W/, '_').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
Consider simplifying this complex logical expression. Open
if PadrinoTasks.load?(:activerecord, defined?(ActiveRecord))
# Fixes for Yardoc YRI Building
begin
require 'active_record'
require 'active_record/schema'
Method output_migration_file
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def output_migration_file(filename, name, columns, options={})
if behavior == :revoke
remove_migration(name)
else
return if migration_exist?(filename)
- 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 build_uri_query
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def build_uri_query(object, namespace = nil)
case object
when Hash
object.map do |key, value|
next if value == {} || 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 create_db
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def self.create_db(adapter, user, password, host, database, charset, collation)
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 route
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
def route(verb, path, *args, &block)
options = case args.size
when 2
args.last.merge(:map => args.first)
when 1
Class Message
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Message # @private
include Sinatra::Templates
include Padrino::Rendering if defined?(Padrino::Rendering)
include Padrino::Helpers::RenderHelpers if defined? Padrino::Helpers::RenderHelpers
attr_reader :template_cache
Class Storage
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Storage
include Enumerable
# @private
def initialize(session=nil)
File tooltip.js
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* ========================================================================
* Bootstrap: tooltip.js v3.1.0
* http://getbootstrap.com/javascript/#tooltip
* Inspired by the original jQuery.tipsy by Jason Frame
* ========================================================================
Method setup!
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def self.setup!
config_level = (PADRINO_LOG_LEVEL || Padrino.env || :test).to_sym # need this for PADRINO_LOG_LEVEL
config = Config[config_level]
unless config
- 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"