Showing 8 of 8 total issues
Method check_pass
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def check_pass
# Check for default images
[99, 159, 336].each do |size|
raise "Logo#{size}x#{size} missing" unless @files.detect {|f| f[:name] == "Logo#{size}x#{size}.png" }
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 output_zip
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def output_zip
buffer = Zip::OutputStream.write_buffer do |zip|
zip.put_next_entry 'WalletItem.xml'
zip.write @pass.to_s
Method check_pass
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_pass
# Check for default images
[99, 159, 336].each do |size|
raise "Logo#{size}x#{size} missing" unless @files.detect {|f| f[:name] == "Logo#{size}x#{size}.png" }
end
Method convert_to_xml
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def convert_to_xml(key, val)
case val
when Hash
el = XML::Node.new(key)
val.each do |k,v|
- 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 convert_to_xml
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def convert_to_xml(key, val)
case val
when Hash
el = XML::Node.new(key)
val.each do |k,v|
Method call
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call(env)
@parameters['authToken'] = env['HTTP_AUTHENTICATIONTOKEN'] if env['HTTP_AUTHENTICATIONTOKEN']
@parameters.merge!(Rack::Utils.parse_nested_query(env['QUERY_STRING']))
@parameters['path'] = env['PATH_INFO']
@parameters['host'] = env['HOST']
Method output_zip
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def output_zip
buffer = Zip::OutputStream.write_buffer do |zip|
zip.put_next_entry 'WalletItem.xml'
zip.write @pass.to_s
- 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)
@parameters['authToken'] = env['HTTP_AUTHENTICATIONTOKEN'] if env['HTTP_AUTHENTICATIONTOKEN']
@parameters.merge!(Rack::Utils.parse_nested_query(env['QUERY_STRING']))
@parameters['path'] = env['PATH_INFO']
@parameters['host'] = env['HOST']
- 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"