Showing 9 of 11 total issues
Method new
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def new(name, path = nil)
say 'Generating scaffold...'
@name = name
@path = 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 call
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def call(message, backtrace, options = {}, _env = nil)
result = message.is_a?(Napa::JsonError) ? message : Napa::JsonError.new(:api_error, message)
if (options[:rescue_options] || {})[:backtrace] && backtrace && !backtrace.empty?
result = result.to_h.merge(backtrace: backtrace)
- 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_migration_file
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_migration_file
return unless options[:migration] && options[:parent].nil?
if options[:indexes] == false
attributes.each { |a| a.attr_options.delete(:index) if a.reference? && !a.has_index? }
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 next_level
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def next_level(level)
fail 'Unidentified Level' unless [:major, :minor, :patch].include?(level)
parts = Napa::VERSION.split('.').map { |p| p.to_i }
- 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
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse(column_definition)
name, type, has_index = column_definition.split(':')
# if user provided "name:index" instead of "name:string:index"
# type should be set blank so GeneratedAttribute's constructor
- 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 emitter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def emitter
unless @emitter
# Log an error if StatsD settings are not configured
message = 'StatsD host and port not configured in environment variables, using default settings'
Napa::Logger.logger.warn message unless ENV['STATSD_HOST'] && ENV['STATSD_PORT']
- 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 format_request
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def format_request(env)
request = Rack::Request.new(env)
params = request.params
begin
- 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 call
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def call(env)
if authenticated_request?(env)
@app.call(env)
else
if !(@old_allowed_passwords.blank? && @allowed_header_passwords.blank?)
- 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 authenticated_request?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def authenticated_request?(env)
return if @old_allowed_passwords.blank? && @allowed_header_passwords.blank?
if env['HTTP_PASSWORDS'].present?
possible_passwords = env['HTTP_PASSWORDS'].to_s.split(',')
- 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"