raubarede/Ruiby

View on GitHub

Showing 209 of 263 total issues

Method set_row has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def scrolled_win.set_row(data,parent=nil)
      puts "treeview: raw data size nok : #{data.size}/#{data.inspect}" if data.size!=@types.size
      i=0
      c=self.model.append(parent)
      data.zip(@types) do |item,clazz|
Severity: Minor
Found in lib/ruiby_gtk/dsl/list_grid.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 get_data_yahoo has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def get_data_yahoo(lcotes)
  fields=[
    :name,
    :last_trade_price,:last_trade_time,
    :volume,:previous_close,
Severity: Minor
Found in samples/gadget_trading.rb - About 1 hr to fix

    Method do_dialog has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def do_dialog() 
        l=@licones_name.grep(/#{@e.text}/) 
        if l.size==0
          alert("no found *#{@e.text}*")
          return
    Severity: Minor
    Found in samples/icones.rb - About 1 hr to fix

      Method script has a Cognitive Complexity of 9 (exceeds 5 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 55 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 apply_options has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def apply_options(w,options)
            w.set_size_request(*options[:size])                                 if options[:size] 
            w.set_border_width(options[:margins])                               if options[:margins]  
            w.width_request=(options[:width].to_i)                              if options[:width]
            w.height_request=(options[:height].to_i)                            if options[:height]
      Severity: Minor
      Found in lib/ruiby_gtk/ruiby_dsl3.rb - About 55 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 sdata has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def sdata(prefix,str0)
        str=if $short
          str0&&(str0.length>800 ?  str0.slice(0..800) + " ..." : str0)
        else
          str0||""
      Severity: Minor
      Found in samples/spygui.rb - About 55 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 make_example has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def make_example(hdoc,filename)
        count= $hexample.size
        src=File.dirname(__FILE__)+"/"+filename
        ifn="media/snapshot_#{filename}.png"
        system('ruby',src,"take-a-snapshot") if ARGV.size==0 || (! File.exists?(ifn))
      Severity: Minor
      Found in samples/make_doc.rb - About 55 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 video has a Cognitive Complexity of 9 (exceeds 5 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 55 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 execute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def execute(err=true,text=nil)
          @content= text ? text : @edit.buffer.text
          clear_append_to(@demo) {
            frame { stack {
            eval(@content,binding() ,"<script>",1) 
      Severity: Minor
      Found in samples/sketchi.rb - About 55 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 bench has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def bench(code)
           begin
              eval( "class Test ; def self.test()  #{([code]*100).join(" ; ")} ;  end ; end ",$global)
              __i=0
              istep=100 # number of Test.test() in the while()
      Severity: Minor
      Found in samples/benchi.rb - About 55 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 _set_gradient has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def cv._set_gradient(cv,cr,acolor,lxy)
            type,sens,*data=acolor
            return unless type && sens && data && data.size>=2
            cr.set_source_rgba(*Ruiby_dsl.cv_color_html("#FFF"))
            if type =~ /^g/
      Severity: Minor
      Found in lib/ruiby_gtk/dsl/canvas.rb - About 55 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 _process_terminal_key has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def _process_terminal_key(w,ev,termBuffer)
          char=(ev.keyval.chr rescue nil)
          #p ["%08X" % ev.keyval , char]
          up=65362
          down=65364
      Severity: Minor
      Found in lib/ruiby_gtk/ruiby_terminal.rb - About 55 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 button has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def button(text,option={},&blk)
          if text && text[0,1]=="#"
            b=Button.new(:label => nil, :mnemonic => nil, :stock_id => nil);
            text,tooltip=text[1..-1].split("//")
            b.set_image( get_image(text) )
      Severity: Minor
      Found in lib/ruiby_gtk/dsl/label_button_image.rb - About 55 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 tree_grid has a Cognitive Complexity of 9 (exceeds 5 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: Minor
      Found in lib/ruiby_gtk/dsl/list_grid.rb - About 55 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 _check_append has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def _check_append(name,w,wref)
          raise("#{name}(w,r) : Widget ref not created!") unless wref
          raise("#{name}(w,r) : new Widget not created!") unless w
          parent=wref.parent
          raise("#{name}(w,r): r=#{parent.inspect} is not a XBox or Frame !") unless !parent || parent.kind_of?(Container)
      Severity: Minor
      Found in lib/ruiby_gtk/dsl/commands.rb - About 55 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 prompt has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def prompt(txt,value="") 
           dialog = Dialog.new(
            title: "Message",
            parent: self,
            flags: [Dialog::DESTROY_WITH_PARENT],
      Severity: Minor
      Found in lib/ruiby_gtk/ruiby_default_dialog3.rb - About 55 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_image_from has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def get_image_from(name,size=:button)
          if name.index('.') 
            return Image.new(file: name) if File.exists?(name)
            return _sub_image(name) if name.index("[")
            alert("unknown icone #{name}")
      Severity: Minor
      Found in lib/ruiby_gtk/dsl/pixmap.rb - About 55 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 draw_aig has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def draw_aig(cv,x,y,r,pos,width,color)
      Severity: Major
      Found in samples/gadget_clock.rb - About 50 mins to fix

        Method draw_curve1 has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def draw_curve1(curve,i,x0,y0,unit, type, vy)
        Severity: Major
        Found in samples/gadget_trading.rb - About 50 mins to fix

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

              def initialize(title,width=350,height=600,captions=[["oups"]],data=[["no data"]],options={},&bloc)
          Severity: Major
          Found in lib/ruiby_gtk/editor.rb - About 50 mins to fix
            Severity
            Category
            Status
            Source
            Language