Showing 11 of 11 total issues
Method add_individual_routes!
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def add_individual_routes!
assets.served.each do |path, from|
get %r{#{"^/#{path}/".squeeze('/')}(.*)$} do |file|
fmt = File.extname(file)[1..-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
Class Options
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Options
include Builder
include Configurator
def initialize(app, &blk)
Method add_individual_routes!
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_individual_routes!
assets.served.each do |path, from|
get %r{#{"^/#{path}/".squeeze('/')}(.*)$} do |file|
fmt = File.extname(file)[1..-1]
Method combined
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def combined
session = Rack::Test::Session.new(@assets.app)
paths.map { |path|
result = session.get(path)
if result.body.respond_to?(:force_encoding)
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def initialize(app, &blk)
unless app.root?
raise Error, "Please set :root in your Sinatra app."
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 preproc
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.preproc(source, assets)
source.gsub(/url\((["']?)(.*?)(["']?)\)/) do |match|
# Not parsable by URI.parse
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 compress
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def compress(str, type, engine=nil, options={})
# Use defaults if no engine is given.
return fallback(str, type, options) if engine.nil?
# Ensure that the engine 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
Method dimensions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def dimensions
return @dimensions unless @dimensions.nil?
dim = /(\d+) x (\d+)/.match(`file "#{@file}"`)
w, h = dim[1,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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(assets, name, type, path, filespecs)
Method get_file_uri
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_file_uri(file, assets)
raise RuntimeError, "You must pass in an asset for a URI to be created for it." if file.nil?
local = assets.local_file_for file
- 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 files
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def files(match=nil)
return @files unless @reload_files_cache
# All
# A buncha tuples
- 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"