raubarede/Ruiby

View on GitHub

Showing 209 of 263 total issues

Method << has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def <<(a,b=nil,c=nil,d=nil)
      if b==nil
        Bbox === a ? add_bbox(a) : Array===a ? add_point(*a) : raise("error param bbox << ...")
      elsif c==nil
        add_point(a,b)
Severity: Minor
Found in samples/draw.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 fentry has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def fentry(value,option={},&blk)
    # TODO Dyn
    w=SpinButton.new(option[:min].to_f,option[:max].to_f,option[:by].to_f)
    w.set_numeric(true)
    w.set_value(value ? value.to_f : 0.0)
Severity: Minor
Found in lib/ruiby_gtk/dsl/form_fields.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

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

  def snapshot(filename=nil)
     return unless  RUBY_PLATFORM =~ /in.*32/
     require 'win32/screenshot'
     require 'win32ole'
     
Severity: Minor
Found in lib/ruiby_gtk/dsl/commands.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 _paned has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def _paned(horizontal,size,fragment)    
    s=stack {} # create a temporary container for inner widgets
    @lcur << s
    yield()
    autoslot
Severity: Minor
Found in lib/ruiby_gtk/dsl/layouts.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 image has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def image(file,options={})
    im=if File.exists?(file)
      pix=get_pixmap(file)
      pix=pix.scale(options[:width],options[:height],Gdk::Pixbuf::INTERP_BILINEAR) if options[:width] && options[:height]
      pix=pix.scale(options[:size],options[:size],Gdk::Pixbuf::INTERP_BILINEAR)  if options[:size] 
Severity: Minor
Found in lib/ruiby_gtk/dsl/label_button_image.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 set_as_bool has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def set_as_bool(v) 
    @value=case  @value
         when Numeric then v ? 1 : 0 
         when String then v ? "1" : ""
         else !!v
Severity: Minor
Found in lib/ruiby_gtk/dyn_var.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 trace has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def trace(*txt)
    if $__mainthread__ && $__mainthread__ != Thread.current
      gui_invoke { log(*txt) }
      return
    end
Severity: Minor
Found in lib/ruiby_gtk/dsl/commands.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 rposition has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def rposition(x,y)
    if x==0 && y==0
      set_window_position Gtk::WindowPosition::CENTER
      return
    elsif     x>=0 && y>=0
Severity: Minor
Found in lib/ruiby_gtk/windows.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 color_choice has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def color_choice(text=nil,options={},&cb)
    but,lab=nil,nil
    out=flow { 
      but = button((text||"Color?...").to_s) do
        c=ask_color    
Severity: Minor
Found in lib/ruiby_gtk/dsl/form_fields.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

Avoid too many return statements within this method.
Open

      return nil
Severity: Major
Found in lib/ruiby_gtk/dsl/pixmap.rb - About 30 mins to fix

    Method gui_invoke has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def gui_invoke(&blk) 
      if ! defined?($__mainwindow__)
        puts("\n\ngui_invoke() : initialize() of main windows not done!\n\n") 
        return
      end
    Severity: Minor
    Found in lib/ruiby_gtk/ruiby_threader.rb - About 25 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 gui_invoke_in_window has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def gui_invoke_in_window(w,&blk) 
      if ! defined?($__mainwindow__)
        puts("\n\ngui_invoke() : initialize() of main windows not done!\n\n") 
        return
      end
    Severity: Minor
    Found in lib/ruiby_gtk/ruiby_threader.rb - About 25 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 fload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def fload(file,content)
        if File.exists?(file) && content==nil
          content=File.read(file)
        end
        return unless content!=nil 
    Severity: Minor
    Found in samples/canvas.rb - About 25 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 end_command has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def end_command(item)
          lw=@lw.dup
          @lw=[]
          return if !item || item.size==0 || lw.size<1
          puts " menu: #{item} ==> #{lw.join(' ')}"
    Severity: Minor
    Found in samples/systray.rb - About 25 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 test_table has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def test_table
        frame("Forms",margins: 10,bg: "#FEE") { table(2,10,{set_column_spacings: 3}) do
            row { cell_right(label  "state")             ; cell(button("set") { alert("?") }) }
            row { cell_right label  "speed"              ; cell(entry("aa"))  }
            row { cell_right label  "size"               ; cell ientry(11,{:min=>0,:max=>100,:by=>1})  }
    Severity: Minor
    Found in samples/test.rb - About 25 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_selected has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          ;  def set_selected(indice)
            b0.group.reverse.each_with_index { |w,index| 
             if !w.active? && indice.to_i==index
               puts "setsel #{index}"
               w.set_active(true) rescue p $!
    Severity: Minor
    Found in lib/ruiby_gtk/dsl/form_fields.rb - About 25 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 load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def load(file,content)
        if File.exists?(file) && content==nil
          content=File.read(file)
        end
        return unless content!=nil 
    Severity: Minor
    Found in samples/sketchi.rb - About 25 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