Showing 158 of 214 total issues
Method prepare_allowed_params
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def prepare_allowed_params(allowed_params)
param_filter = {}
allowed_params.each do |key,value|
case
when key.kind_of?(Hash) && !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
Function activate
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Tab.prototype.activate = function (element, container, callback) {
var $active = container.find('> .active')
var transition = callback
&& $.support.transition
&& $active.hasClass('fade')
Method create_db
has 26 lines of code (exceeds 25 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?
Method match_with_arguments?
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def match_with_arguments?(request)
route = request.route_obj
path = request.path_info
@args.any? do |argument|
if argument.instance_of?(Symbol)
- 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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize(template, object, options={})
@template = template
fail "FormBuilder template must be initialized" unless template
@object = object.kind_of?(Symbol) ? build_object(object) : object
fail "FormBuilder object must be present. If there's no object, use a symbol instead (i.e. :user)" unless object
- 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 parse_conditions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_conditions(url, options)
if options.has_key?(:if)
condition = options.delete(:if)
condition == :current ? url == request.path_info : condition
elsif condition = options.delete(:unless)
- 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 parse_data_options
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def parse_data_options(tag, options)
return unless options
parsed_options = options.dup
options.each do |key, value|
next if !DATA_ATTRIBUTES.include?(key) || (tag.to_s == 'form' && key == :method)
- 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 asset_timestamp
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def asset_timestamp(file_path)
return nil if file_path =~ /\?/ || (self.class.respond_to?(:asset_stamp) && !self.class.asset_stamp)
public_path = self.class.public_folder if self.class.respond_to?(:public_folder)
public_path ||= Padrino.root("public") if Padrino.respond_to?(:root)
public_file_path = File.join(public_path, file_path) if public_path
- 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 flash_tag
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def flash_tag(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
bootstrap = options.delete(:bootstrap) if options[:bootstrap]
args.inject(SafeBuffer.new) do |html,kind|
next html unless flash[kind]
- 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 setup_plugin
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def setup_plugin
if options[:list] || plugin_file.nil?
list_plugins
else # executing the plugin instructions
self.destination_root = options[:root]
- 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_template
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def resolve_template(template_path, options={})
template_path = template_path.to_s
controller_key = respond_to?(:request) && request.respond_to?(:controller) && request.controller
rendering_options = [template_path, content_type || :html, locale]
- 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 get_mongoid_models
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_mongoid_models
documents = []
Dir['{app,.}/models/**/*.rb'].sort.each do |file|
model_path = file[0..-4].split('/')[2..-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_db
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.create_db(adapter, user, password, host, database, charset, collation)
Method word_wrap
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def word_wrap(text, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
unless args.empty?
options[:line_width] = args[0] || 80
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 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
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 number_with_precision
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def number_with_precision(number, *args)
options = args.last.is_a?(Hash) ? Utils.symbolize_keys(args.pop) : {}
defaults = I18n.translate(:'number.format', :locale => options[:locale], :raise => true) rescue {}
precision_defaults = I18n.translate(:'number.precision.format', :locale => options[:locale],
- 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)
Method with_layout
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def with_layout(options)
options = options.dup
layout = options[:layout]
return options if layout == 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
Method detect_application
has a Cognitive Complexity of 8 (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"