Method canvas
has 308 lines of code (exceeds 25 allowed). Consider refactoring. Open
def canvas(width,height,option={})
autoslot()
cv=DrawingArea.new()
cv.width_request=width
cv.height_request=height
File canvas.rb
has 412 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Ruiby_dsl
# Create a drawing area, for pixel/vectoriel draw
# for interactive actions see test.rb fo little example.
#
Method canvasOld
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def canvasOld(width,height,option={})
puts "*** DEPRECATED: use canvas do end in place of canvasOld ***"
autoslot()
w=DrawingArea.new()
w.width_request=width
- 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 draw_varbarr
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def cv.draw_varbarr(x0,y0,x1,y1,dmin,dmax,lvalues0,width,&b)
ax=1.0*(x1-x0)/(dmax-dmin) ;bx= x0-ax*dmin
ay=1.0*(y1-y0)/(dmax-dmin) ;by= y0-ay*dmin
xconv=proc {|d| (x1==x0) ? x1 : (ax*d+bx) }
yconv=proc {|d| (y1==y0) ? y1 : (ay*d+by) }
- 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 draw_pie
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def cv.draw_pie(x0,y0,r,l_ratio_color_txt,with_legend=false)
lcolor=%w{#F00 #A00 #AA0 #AF0 #AAF #AAA #FAF #AFA #33F #044}
cv,ctx=@currentCanvasCtx
start=3.0*Math::PI/2.0
total=l_ratio_color_txt.inject(0.0) { |sum,(a)| sum+a }
- 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 canvasOld
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def canvasOld(width,height,option={})
puts "*** DEPRECATED: use canvas do end in place of canvasOld ***"
autoslot()
w=DrawingArea.new()
w.width_request=width
Method _set_gradient
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def cv._set_gradient(cv,cr,acolor,lxy)
type,sens,*data=acolor
return unless type && sens && data && data.size>=2
cr.set_source_rgba(*Ruiby_dsl.cv_color_html("#FFF"))
if type =~ /^g/
- 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 _draw_poly
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def cv._draw_poly(lxy,color_fg,color_bg,width)
raise("odd number of coord for lxy") if !lxy || lxy.size==0 || lxy.size%2==1
w,cr=@currentCanvasCtx
cr.set_line_width(width) if width
x0,y0,*poly=*lxy
- 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 draw_rounded_rectangle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def cv.draw_rounded_rectangle(x0,y0,w,h,ar,colorStroke,colorFill,widthStroke)
cv,cr=@currentCanvasCtx
pi=Math::PI
ar=[ar,ar,ar,ar] if ar.kind_of?(Numeric)
if Array === colorFill
- 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 bbox
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def cv.bbox(lxy)
xmin,ymin=lxy[0..1]
xmax,ymax=lxy[0..1]
lxy.each_slice(2) {|x,y|
xmin=x if x<xmin ;ymin=y if y<ymin
- 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 on_canvas_button_motion
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def on_canvas_button_motion(&blk )
_accept?(:handler)
@currentCanvas.signal_connect('motion_notify_event') { |w,e|
next unless w.get_memo()
w.set_memo(blk.call(w,e,w.get_memo)) rescue error($!)
- 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"