raubarede/Ruiby

View on GitHub

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)
Severity: Minor
Found in samples/sketchi.rb - About 1 hr to fix

    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
    Severity: Minor
    Found in lib/ruiby_gtk/windows.rb - About 1 hr to fix

      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))
      Severity: Major
      Found in samples/aerial_viewer.rb and 1 other location - About 1 hr to fix
      samples/tilesviewer.rb on lines 182..195

      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

      Further Reading

      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))
      Severity: Major
      Found in samples/tilesviewer.rb and 1 other location - About 1 hr to fix
      samples/aerial_viewer.rb on lines 182..195

      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

      Further Reading

      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|
      Severity: Minor
      Found in lib/ruiby_gtk/dsl/form_fields.rb - About 1 hr to fix

        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
        Severity: Minor
        Found in lib/ruiby_gtk/systray.rb - About 1 hr to fix

          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)
          Severity: Minor
          Found in samples/gadget.rb - About 1 hr to fix

            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
            Severity: Minor
            Found in lib/ruiby_gtk/dsl/list_grid.rb - About 1 hr to fix

              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
              Severity: Minor
              Found in lib/ruiby_gtk/dsl/form_fields.rb - About 1 hr to fix

              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) {
              Severity: Minor
              Found in samples/all.rb - About 1 hr to fix

              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
                  
              Severity: Minor
              Found in samples/minicalc.rb - About 1 hr to fix

              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
              Severity: Minor
              Found in samples/gadget_trading.rb - About 1 hr to fix

              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)
              Severity: Minor
              Found in samples/canvas.rb - About 1 hr to fix

              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") }
              Severity: Minor
              Found in samples/accordion.rb - About 1 hr to fix

                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
                Severity: Minor
                Found in lib/Ruiby.rb - About 1 hr to fix

                  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
                  Severity: Minor
                  Found in lib/ruiby_gtk/dsl/script.rb - About 1 hr to fix

                    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)
                    Severity: Minor
                    Found in samples/canvas.rb - About 1 hr to fix

                      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 }
                      Severity: Minor
                      Found in samples/test.rb - About 1 hr to fix

                        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]}"
                        Severity: Minor
                        Found in samples/gadget_trading.rb - About 1 hr to fix

                          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" ;}
                          Severity: Minor
                          Found in samples/table2.rb - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language