Method get_pixbuf
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def get_pixbuf(name)
@cach_pix={} unless defined?(@cach_pix)
if @cach_pix.size>100
puts "purge cached pixbuf (>100)"
@cach_pix={}
- 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 get_pixmap
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_pixmap(name)
if name=~ /^(famfamfam|crystal|farmfresh)/
name=Dir.glob("#{Ruiby::MEDIA}/#{name.split(/\s+/).join("*")}*").first
end
if name.index('.')
- 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 get_image_from
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_image_from(name,size=:button)
if name.index('.')
return Image.new(file: name) if File.exists?(name)
return _sub_image(name) if name.index("[")
alert("unknown icone #{name}")
- 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
Consider simplifying this complex logical expression. Open
if filename && px && py && bidon && dim && File.exist?(filename)
dim=dim.to_i
@cach_pix[filename]=Gdk::Pixbuf.new(:file =>filename) unless @cach_pix[filename]
x0= dim*px.to_i
y0= dim*py.to_i
Avoid too many return
statements within this method. Open
return nil
Method get_stockicon_pixbuf
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_stockicon_pixbuf(name)
begin
icn="#{name.downcase.gsub('_','-')}"
return Gtk::IconTheme.default().load_icon(icn,16,0)
rescue Exception => ee
- 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"