Showing 158 of 214 total issues
Method setup
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def setup
Padrino::Generators.load_components!
generator_kind = ARGV.delete_at(0).to_s.downcase.to_sym if ARGV[0] && !ARGV[0].empty?
generator_class = Padrino::Generators.mappings[generator_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 except?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def except?(env)
return false unless @except
path_info = env['PATH_INFO']
@except.is_a?(Proc) ? @except.call(env) : @except.any?{|path|
path.is_a?(Regexp) ? path.match(path_info) : path == path_info }
- 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 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
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 map_onto
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def map_onto(router)
app_data = self
app_obj = @app_obj
uri_root = app_data.uri_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 output_model_migration
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def output_model_migration(filename, name, columns, options={})
if behavior == :revoke
remove_migration(filename)
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 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
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, data=nil, options={}, locals={}, &block)
Method render_like_sinatra
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def render_like_sinatra(engine, data, 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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(mode, scoped_controller, options, args, &block)
Method render
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def render(engine=nil, data=nil, options={}, locals={}, &block)
Method drop_db
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.drop_db(adapter, user, password, host, database)
Method singularize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def singularize(s)
s = s.to_s
return s.singularize if s.respond_to?(:singularize)
result = s.dup
Inflections.singulars.each{|(rule, replacement)| break if result.gsub!(rule, replacement)} unless Inflections.uncountables.include?(s.downcase)
- 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 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 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"
Further reading
Method load_boot
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def load_boot
begin
ENV['PADRINO_LOG_LEVEL'] ||= 'test'
ENV['BUNDLE_GEMFILE'] = File.join(options[:root], 'Gemfile') if options[:root]
boot = options[:root] ? File.join(options[:root], 'config/boot.rb') : 'config/boot.rb'
- 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 pluralize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def pluralize(s)
s = s.to_s
return s.pluralize if s.respond_to?(:pluralize)
result = s.dup
Inflections.plurals.each{|(rule, replacement)| break if result.gsub!(rule, replacement)} unless Inflections.uncountables.include?(s.downcase)
- 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"