raubarede/Ruiby

View on GitHub

Showing 209 of 263 total issues

Method component has a Cognitive Complexity of 25 (exceeds 5 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 3 hrs 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 track has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

     def plot.track(event)
      return unless @config[:tracker]
      x=nil
      lt=@curves.each_with_object([]) {|(name,d),a|
        next unless d[:type]==:curve
Severity: Minor
Found in lib/ruiby_gtk/dsl/plot.rb - About 3 hrs 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 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def component()
    stack do
    #------------ title + entry
    stacki do
      flow do
Severity: Major
Found in samples/benchi.rb - About 3 hrs to fix

    Method expose has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

         def plot.expose(w,ctx) 
            return unless @curves
            w.draw_rectangle(0,0,@config[:w],@config[:h],0,nil,@config[:bg],0) if @config[:bg]
            if @config[:grid] 
              dx=dy=(@config[:grid]||"40").to_i
    Severity: Minor
    Found in lib/ruiby_gtk/dsl/plot.rb - About 3 hrs 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

    File layouts.rb has 308 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Ruiby_dsl
      
      ############################ Slot : H/V Box or Frame
    
      # container : vertical box, take all space available, sloted in parent by default
    Severity: Minor
    Found in lib/ruiby_gtk/dsl/layouts.rb - About 3 hrs to fix

      Method run_window has 83 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def run_window()
          Ruiby.app width: $W, height: $H, title: "Curve" do
          fn=Ruiby::MEDIA+"/famfamfam/chart_curve.png"
          set_icon(fn) if File.exists?(fn)
          set_resizable(true)
      Severity: Major
      Found in samples/pipeplot.rb - About 3 hrs to fix

        Method component has 82 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def component()          
            stack do
              ################## Menu
              menu_bar do
                menu("File") {
        Severity: Major
        Found in samples/draw.rb - About 3 hrs to fix

          Method component has a Cognitive Complexity of 23 (exceeds 5 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 3 hrs 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 dialog_icones has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

            def dialog_icones
              dialog "Ruiby Predefined icones" do
                  stack do
                    scrolled(400,500) { 
                      Gtk::IconTheme.default.icons.sort.map { |name|  
          Severity: Minor
          Found in samples/sketchi.rb - About 3 hrs 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

          File form_fields.rb has 293 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module Ruiby_dsl
            ############### Inputs widgets
          
            # combo box. 
            # Choices are describes with:
          Severity: Minor
          Found in lib/ruiby_gtk/dsl/form_fields.rb - About 3 hrs to fix

            Class VElem has 26 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class VElem
                def initialize() @lpoints=[];@style={} end
                def bbox()
                  @lpoints.inject(Bbox.new){ |bb,p| bb << [p[0],p[1]] }
                end
            Severity: Minor
            Found in samples/draw.rb - About 3 hrs to fix

              Method list has 73 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def list(title,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: Major
              Found in lib/ruiby_gtk/dsl/list_grid.rb - About 2 hrs to fix

                Method tree_grid has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def tree_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: Major
                Found in lib/ruiby_gtk/dsl/list_grid.rb - About 2 hrs to fix

                  Method initialize has a Cognitive Complexity of 21 (exceeds 5 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 2 hrs 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 execute has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def execute(line=nil)
                      line||=get_line
                      line=line.strip
                      return if line.size==0
                      
                  Severity: Minor
                  Found in lib/ruiby_gtk/ruiby_terminal.rb - About 2 hrs 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 properties has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def properties(title,hash,options={:edit=>false, :scroll=>[0,0]})
                      if ! defined?(@prop_index)
                        @prop_index=0
                        @prop_hash={}
                      else
                  Severity: Minor
                  Found in lib/ruiby_gtk/ruiby_dsl3.rb - About 2 hrs 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_pixbuf has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def get_pixbuf(name)
                      @cach_pix={} unless defined?(@cach_pix)
                      if @cach_pix.size>100
                        puts "purge cached pixbuf (>100)"
                        @cach_pix={}
                  Severity: Minor
                  Found in lib/ruiby_gtk/dsl/pixmap.rb - About 2 hrs 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

                  File ruiby_dsl3.rb has 281 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require_relative 'ruiby_default_dialog3.rb'
                  module Ruiby_dsl
                    include ::Gtk
                    include ::Ruiby_default_dialog
                  end
                  Severity: Minor
                  Found in lib/ruiby_gtk/ruiby_dsl3.rb - About 2 hrs to fix

                    Method execute has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def execute(line=nil)
                        line||=get_line
                        line=line.strip
                        return if line.size==0
                        
                    Severity: Major
                    Found in lib/ruiby_gtk/ruiby_terminal.rb - About 2 hrs to fix

                      Method draw_varbarr has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def cv.draw_varbarr(x0,y0,x1,y1,dmin,dmax,lvalues0,width,&b)
                            ax=1.0*(x1-x0)/(dmax-dmin) ;bx= x0-ax*dmin 
                            ay=1.0*(y1-y0)/(dmax-dmin) ;by= y0-ay*dmin 
                            xconv=proc {|d| (x1==x0) ? x1 :  (ax*d+bx) }
                            yconv=proc {|d| (y1==y0) ? y1 :  (ay*d+by) }
                      Severity: Minor
                      Found in lib/ruiby_gtk/dsl/canvas.rb - About 2 hrs 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