Showing 263 of 263 total issues
Method component
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def component()
stack do
htoolbar_with_icon_text do
button_icon_text "open","Open file..." do
load(ask_file_to_read(".","*.rb"),nil)
Method initialize
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(title,w,h)
super()
$app=self unless defined?($app)
init_threader()
#threader(10) # must be call by user window, if necessary
Identical blocks of code found in 2 locations. Consider refactoring. Open
anim(20) {
#@lon0+=0.001
if @lon0!=@lonRef || @lat0!=@latRef || @zRef!=@z
@lon0+= sqrs((@lonRef-@lon0))
@lat0+= sqrs((@latRef-@lat0))
- 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 69.
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
anim(20) {
#@lon0+=0.001
if @lon0!=@lonRef || @lat0!=@latRef || @zRef!=@z
@lon0+= sqrs((@lonRef-@lon0))
@lat0+= sqrs((@latRef-@lat0))
- 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 69.
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
Method _radio_buttons
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _radio_buttons(sens,ltext=["empty!"],value=-1,&blk)
is_dyn = (DynVar === value)
b0=nil
s=var_box(sens,{},false) {
ltext.each_with_index {|txt,i|
Method initialize
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(window,title="title?",config,x0,y0)
$statusIcon=self
@popup_tray=Menu.new
@checkMenu={}
file= (config[:icon] && File.exist?(config[:icon])) ? config[:icon] : nil
Method expose
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def expose(cv,ctx)
ssize=cv.get_size_request()
############## Liste
@cv.draw_rectangle(0,0,ssize.first,ssize.last,0,nil,"#888",0)
@cv.draw_rectangle(2,2,ssize.first-4,ssize.last-4,15,"#555",$BG,3)
Method grid
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def grid(names,w=0,h=0,options={})
scrolled_win = Gtk::ScrolledWindow.new
scrolled_win.set_policy(:automatic,:automatic)
scrolled_win.set_width_request(w) if w>0
scrolled_win.set_height_request(h) if h>0
Method toggle_button
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def toggle_button(text1,text2=nil,value=false,option={},&blk)
if DynVar === value
return _dyn_toggle_button(text1,text2,value,option,&blk)
end
text2 = "- "+text1 unless text2
- 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 exec
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def exec(l)
@stop=false
l.each_with_index do |s,index|
gui_invoke { @list.set_selection(index) }
timeout(10) {
- 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 ope
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def ope(ope,dvRes,dvVal)
return if dvVal.value==""
expr=ope.size==1 ? "#{dvRes.value.to_f.to_s} #{ope} #{dvVal.value.to_f.to_s}" : "Math.#{ope}(#{dvRes.value.to_f.to_s})"
res= eval(expr).to_f
- 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 show
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def show(app)
app.instance_eval do
#======================== dialog choix cotes et periode
profondeur=DynVar.new(1)
ok=dialog("Cotes") do
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def component()
stack do
htoolbar {
toolbar_button("open","Open file...") {
fload(ask_file_to_read(".","*.rb"),nil)
- 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 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def component()
flow {
accordion {
aitem("entry 1") {
alabel("xeee1") { alert("x1") }
Method ruiby_require
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ruiby_require(*gems)
w=nil
gems=gems.map {|g| g.split(/\s+/)}.flatten
gems.each do|gem|
begin
Method script
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def script(caption="Parameters",nb_column=2,hctx=nil)
$script_pid=nil
@ctx=make_StockDynObject("ctx",hctx) if hctx
stack do
stacki do
Method component
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def component()
stack do
htoolbar {
toolbar_button("open","Open file...") {
fload(ask_file_to_read(".","*.rb"),nil)
Method test_crud
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_crud()
stack do
$gheader=%w{id first-name last-name age}
$gdata=[%w{regis aubarede 12},%w{siger ederabu 21},%w{baraque aubama 12},%w{ruiby ruby 1}]
i=-1; $gdata.map! { |l| i+=1; [i]+l }
Method draw_curve1
has 36 lines of code (exceeds 25 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]}"
Method component
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def component()
stack {
frame("") { table(2,10,{set_column_spacings: 3}) do
row { cell_left label "c1" ; cell_left label "c2" ; cell label "c3" ; cell label "c4" ;}
row { cell_right label "c1" ; cell_left label "c2" ; cell label "c3" ; cell label "c4" ;}