raubarede/Ruiby

View on GitHub

Showing 209 of 263 total issues

Method bbox has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def cv.bbox(lxy)
      xmin,ymin=lxy[0..1]
      xmax,ymax=lxy[0..1]
      lxy.each_slice(2) {|x,y| 
        xmin=x if x<xmin ;ymin=y if y<ymin 
Severity: Minor
Found in lib/ruiby_gtk/dsl/canvas.rb - About 45 mins 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 log has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def log(*txt)
    if $__mainthread__ && $__mainthread__ != Thread.current
      gui_invoke { log(*txt) }
      return
    end
Severity: Minor
Found in lib/ruiby_gtk/dsl/commands.rb - About 45 mins 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

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
Severity: Major
Found in lib/ruiby_gtk/dsl/pixmap.rb - About 40 mins to fix

    Method toggle_button has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def toggle_button(text1,text2=nil,value=false,option={},&blk)
    Severity: Minor
    Found in lib/ruiby_gtk/dsl/form_fields.rb - About 35 mins to fix

      Method add has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def add(noc,y0,y1,label,autoscale)
      Severity: Minor
      Found in samples/pipeplot.rb - About 35 mins to fix

        Method text has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def text(ctx,fs,x,y,text)
        Severity: Minor
        Found in samples/freedom.rb - About 35 mins to fix

          Method find_into_bbox has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def find_into_bbox(x0,y0,x1,y1,nolayer=1)
          Severity: Minor
          Found in samples/draw.rb - About 35 mins to fix

            Method draw_bg has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def draw_bg(cr,w,h,c1,c2)
            Severity: Minor
            Found in samples/fractal.rb - About 35 mins to fix

              Method draw_border has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                def draw_border(ctx,x,y,pdx,pdy)
              Severity: Minor
              Found in samples/tilesviewer.rb - About 35 mins to fix

                Method field has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def field(tlabel,lwidth,value,option={},&blk)
                Severity: Minor
                Found in lib/ruiby_gtk/dsl/form_fields.rb - About 35 mins to fix

                  Method cscale has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    def cscale(l,x,y,cx,cy=nil) trans(scale(trans(l,-x,-y),cx,cy),x,y)                              end
                  Severity: Minor
                  Found in samples/canvas.rb - About 35 mins to fix

                    Method axes has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      def axes(x0,maxx,maxy,pasx,pasy)
                    Severity: Minor
                    Found in samples/canvas.rb - About 35 mins to fix

                      Method draw_border has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        def draw_border(ctx,x,y,pdx,pdy)
                      Severity: Minor
                      Found in samples/aerial_viewer.rb - About 35 mins to fix

                        Method _dyn_toggle_button has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                          def _dyn_toggle_button(text1,text2,var,option={},&blk)
                        Severity: Minor
                        Found in lib/ruiby_gtk/dsl/form_fields.rb - About 35 mins to fix

                          Method find_cover_bbox has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def find_cover_bbox(x0,y0,x1,y1,nolayer=1)
                          Severity: Minor
                          Found in samples/draw.rb - About 35 mins to fix

                            Method draw_tree has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                            def draw_tree(cr,x1, y1, angle, depth)
                            Severity: Minor
                            Found in samples/fractal.rb - About 35 mins to fix

                              Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                def initialize(window,title="title?",config,x0,y0)
                              Severity: Minor
                              Found in lib/ruiby_gtk/systray.rb - About 35 mins to fix

                                Method test_dialogues has a Cognitive Complexity of 7 (exceeds 5 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 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def component()
                                      stack do
                                        labeli(@title)
                                        @form=properties("",@data,@popt) { |a| @bloc.call(a) if @bloc }
                                        case @options["button-direction"] 
                                Severity: Minor
                                Found in lib/ruiby_gtk/editor.rb - About 35 mins 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 get_config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  def get_config(w)
                                    return({"nil"=>""}) unless w && w.class.respond_to?("properties")
                                    w.class.properties().inject({"class"=>w.class.to_s}) { |h,meth| 
                                      data=(w.send(meth) rescue nil)
                                      h[meth]=data.inspect.gsub(/^#/,'')[0..32]  if data 
                                Severity: Minor
                                Found in lib/ruiby_gtk/ruiby_dsl3.rb - About 35 mins 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

                                Severity
                                Category
                                Status
                                Source
                                Language