raubarede/Ruiby

View on GitHub

Showing 209 of 263 total issues

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

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

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

                    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
                    Severity: Minor
                    Found in lib/ruiby_gtk/dsl/script.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 _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()
                    Severity: Minor
                    Found in lib/ruiby_gtk/editor.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 _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 
                    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 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 }
                    Severity: Minor
                    Found in lib/ruiby_gtk/dsl/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 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,
                    Severity: Minor
                    Found in samples/dialogs.rb - About 1 hr to fix

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

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

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