Showing 263 of 263 total issues
Method video
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def video(url=nil,w=300,h=200)
begin
require "gst"
require "clutter-gtk" # gem install clutter-gtk
require "clutter-gst" # gem install clutter-gstreamer
Method source_editor
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def source_editor(args={},&blk)
#return(nil) # loading gtksourceview3 scratch application...
begin
require 'gtksourceview3'
rescue Exception => e
Method _exe_posix
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _exe_posix(cmd,to)
Thread.new(cmd,to) do |cmd,to|
begin
PTY.spawn(cmd) do |read,write,pid|
$ruiby_script_pid= pid
- 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 _button_list
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _button_list()
@options.each do |name,action|
next unless action.respond_to?(:call)
button(name) {
next unless @grid.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 _dyn_toggle_button
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _dyn_toggle_button(text1,text2,var,option={},&blk)
text2 = "- "+text1 unless text2
b=ToggleButton.new(label: text1);
b.signal_connect("clicked") do |w,e|
w.label= w.active?() ? text2.to_s : text1.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 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 test_dialogues
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_dialogues()
$gheader=%w{id first-name last-name age str}
$gdata= (0..10000).to_a.map {|i| ("%d regis%d aubarede%d %d %s" % [i,i,i,i%99,("*"*(i%30))]).split(/\s+/) }
a=PopupTable.new("title of dialog",400,200,
$gheader,
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if Ruiby.gtk_version(3)
dialog = Gtk::FileChooserDialog.new(
:title => title,
:parent => self,
:action => action,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 59.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if Ruiby.gtk_version(3)
dialog = Gtk::FileChooserDialog.new(
:title => title,
:parent => self,
:action => action,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 59.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Consider simplifying this complex logical expression. Open
if @select.size>0 && @select[:list] && @select[:list].size>0
@select[:list].each { |v| v.set_style(options) }
else
@cstyle={
:stroke_width=>options[:width] || 1,
Method component
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def component()
stack do
htoolbar do
toolbar_button("open","ouvrir fichier") {
load(ask_file_to_read(".","*.rb"))
Method test_dialog
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_dialog()
stack do
stacki {
frame("Buttons in frame") {
flow { sloti(button("packed with sloti()") {alert("button packed with sloti()")})
Method get_update
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_update()
Thread.new {
begin
@lv=get_data
gui_invoke { @cv.redraw rescue p $!}
- 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 component
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def component()
stack do
################## Menu
menu_bar do
menu("File") {
- 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 add_ope
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def add_ope(op)
b=case op
when /\+|\-|x|#{DIV}/ then button(op) { push(@number.value) if @number.value.size>0 ; @tbc=true; push(op) }
when "." then button(op) { @number.value=(@number.value||"")+"." if @number.value !~ /\./ }
when "=" then button(op) { calc(pop(),pop(),@number.value) if @stack.size >= 2 }
- 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_curve1
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def draw_curve1(curve,i,x0,y0,unit, type, vy)
w=@sx-4
h=@hcurve
@cv.draw_rectangle(x0,y0,@wcurve,h,1,$PLOT0,$PLOT1,2)
coul="##{%w{FF4 4F4 6060FF FF6060 44F 4FF}[i]}"
- 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 expose
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def expose(cv,ctx)
ssize= size()
@cv.set_size_request(ssize.first-2,ssize.last-2)
cx,cy=ssize.first/2,ssize.last/2
cy=cx if cy>cx
- 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 source_editor
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def source_editor(args={},&blk)
#return(nil) # loading gtksourceview3 scratch application...
begin
require 'gtksourceview3'
rescue Exception => e
- 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"