Showing 158 of 214 total issues
Method path
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def path(name, *args)
params = args.last.is_a?(Hash) ? args.pop : {}
candidates = @routes.select { |route| route.name == name }
fail InvalidRouteException if candidates.empty?
i = 0
- 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 cache_template_path
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def cache_template_path(options)
began_at = Time.now
@_cached_templates ||= {}
logging = defined?(settings) && settings.logging? && defined?(logger)
if !reload_templates? && path = @_cached_templates[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
Avoid deeply nested control flow statements. Open
$stderr.puts "(if you set the charset manually, make sure you have a matching collation)" if config[:charset]
Method valid_model_for?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def valid_model_for?(app)
self.destination_root = options[:root]
return false unless correct_path?
check_app_existence(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 content_tag
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def content_tag(name, content = nil, options = nil, &block)
if block_given?
options = content if content.is_a?(Hash)
content = capture_html(&block)
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 padrino_route_added
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def padrino_route_added(route, verb, path, args, options, block)
Consider simplifying this complex logical expression. Open
if (autoPlace) {
var $parent = this.$element.parent()
var orgPlacement = placement
var docScroll = document.documentElement.scrollTop || document.body.scrollTop
Consider simplifying this complex logical expression. Open
if PadrinoTasks.load?(:sequel, defined?(Sequel))
namespace :sq do
namespace :migrate do
desc "Perform automigration (reset your db data)"
task :auto => :skeleton do
Method render
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def render(engine=nil, data=nil, options={}, locals={}, &block)
Method bench
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def bench(action, began_at, message, level=:debug, color=:yellow)
Method render_like_sinatra
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def render_like_sinatra(engine, data, options={}, locals={}, &block)
Method render
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def render(engine, data=nil, options={}, locals={}, &block)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(mode, scoped_controller, options, args, &block)
Method drop_db
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.drop_db(adapter, user, password, host, database)
Method move_as
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def move_as(type)
step = ENV['STEP'] ? ENV['STEP'].to_i : 1
if less_than_active_record_5_2?
ActiveRecord::Migrator.send(type, 'db/migrate/', step)
- 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 migrate_as
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def migrate_as(type)
version = env_migration_version
fail "MIGRATION_VERSION is required" unless version
if less_than_active_record_5_2?
- 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 registered
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def registered(app)
app.helpers Padrino::Cache::Helpers::ObjectCache
app.helpers Padrino::Cache::Helpers::CacheStore
app.helpers Padrino::Cache::Helpers::Fragment
app.helpers Padrino::Cache::Helpers::Page
- 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 detect_application
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.detect_application(options)
default_config_file = 'config.ru'
if (config_file = options.delete(:config)) || File.file?(default_config_file)
config_file ||= default_config_file
fail "Rack config file `#{config_file}` must have `.ru` extension" unless config_file =~ /\.ru$/
- 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 execute_runner
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def execute_runner(kind, template_file)
# Determine resolved template path
template_file = template_file.to_s
template_path = case
when template_file =~ %r{^https?://} && template_file !~ /gist/
- 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 resolve_checked_values
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def resolve_checked_values(field, options)
selected_values = Array(options[:selected] || field_value(field))
if options[:collection]
_, id_method = *field_methods(options)
selected_values.map do |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"