Method layout
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def self.layout(*spec)
return @layout if spec.size == 0
# Pick up a enclosing FFI::Library
@enclosing_module ||= find_nested_parent
- 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
File ffi.rb
has 394 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Rubinius
module FFI
# Specialised error classes
class TypeError < RuntimeError; end
Method layout
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.layout(*spec)
return @layout if spec.size == 0
# Pick up a enclosing FFI::Library
@enclosing_module ||= find_nested_parent
Avoid deeply nested control flow statements. Open
type_code = @enclosing_module.find_type(f) rescue nil
Method config
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.config(base, *fields)
@size = Rubinius::Config["#{base}.sizeof"]
cspec = Rubinius::LookupTable.new
fields.each do |field|
- 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 []
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def [](field)
offset, type = @cspec[field]
raise "Unknown field #{field}" unless offset
case type
- 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"