lib/glimmer/swt/custom/drawable.rb
Method paint_pixel_by_pixel
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
Open
def paint_pixel_by_pixel(width = nil, height = nil, &each_pixel_color)
if @image_double_buffered
work = lambda do |paint_event|
width ||= swt_drawable.bounds.width
height ||= swt_drawable.bounds.height
- 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 setup_shape_painting
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
Open
def setup_shape_painting
# TODO consider performance optimization relating to order of shape rendering (affecting only further shapes not previous ones)
if @paint_listener_proxy.nil?
shape_painter = lambda do |paint_event|
shape_painting_work = lambda do |paint_event|
- 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 setup_shape_painting
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def setup_shape_painting
# TODO consider performance optimization relating to order of shape rendering (affecting only further shapes not previous ones)
if @paint_listener_proxy.nil?
shape_painter = lambda do |paint_event|
shape_painting_work = lambda do |paint_event|
Method paint_pixel_by_pixel
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def paint_pixel_by_pixel(width = nil, height = nil, &each_pixel_color)
if @image_double_buffered
work = lambda do |paint_event|
width ||= swt_drawable.bounds.width
height ||= swt_drawable.bounds.height