raubarede/Ruiby

View on GitHub

Showing 209 of 263 total issues

Method test_dialog has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def test_dialog()
  stack do
    stacki {
      frame("Buttons in frame") {
        flow { sloti(button("packed with sloti()") {alert("button packed with sloti()")}) 
Severity: Minor
Found in samples/test.rb - About 1 hr to fix

    Method get_update has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def get_update()
        Thread.new {
          begin
            @lv=get_data
            gui_invoke { @cv.redraw rescue p $!}
    Severity: Minor
    Found in samples/gadget.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 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def component()          
        stack do
          ################## Menu
          menu_bar do
            menu("File") {
    Severity: Minor
    Found in samples/draw.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 add_ope has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def add_ope(op) 
          b=case op
            when /\+|\-|x|#{DIV}/ then button(op) { push(@number.value) if @number.value.size>0 ; @tbc=true; push(op) }
            when "."              then button(op) { @number.value=(@number.value||"")+"." if @number.value !~ /\./ }
            when "="              then button(op) { calc(pop(),pop(),@number.value) if @stack.size >= 2 }
    Severity: Minor
    Found in samples/calculator.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_curve1 has a Cognitive Complexity of 11 (exceeds 5 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

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

      def expose(cv,ctx)
        ssize= size()
        @cv.set_size_request(ssize.first-2,ssize.last-2)
        cx,cy=ssize.first/2,ssize.last/2
        cy=cx if cy>cx
    Severity: Minor
    Found in samples/gadget_clock.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 source_editor has a Cognitive Complexity of 11 (exceeds 5 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

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

      def get_pixmap(name)
        if name=~ /^(famfamfam|crystal|farmfresh)/
          name=Dir.glob("#{Ruiby::MEDIA}/#{name.split(/\s+/).join("*")}*").first
        end    
        if name.index('.') 
    Severity: Minor
    Found in lib/ruiby_gtk/dsl/pixmap.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 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def component()   
      (puts "\n\n####define style...####\n\n" ; def_style "* { background-image:  -gtk-gradient(linear, left top, left bottom, from(#AAA), to(@888));border-width: 3;}") if ARGV.size>0 && ARGV[0]=~/css/i
      after(1000) {puts "\n\n\n"  ; Gem.loaded_specs.each {|name,gem| puts "  #{gem.name}-#{gem.version}"} }
      mlog 'before Component'
      stack do
    Severity: Minor
    Found in samples/test.rb - About 1 hr to fix

      Method extract_doc_dsl has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def extract_doc_dsl() 
          glob=File.dirname(__FILE__)+"/../lib/ruiby_gtk/**/*.rb"
        hdoc={}
        Dir[glob].each do |src| next if src =~ /dsl.rb/
          content=File.read(src)
      Severity: Minor
      Found in samples/make_doc.rb - About 1 hr to fix

        Method test_menu has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def test_menu
              stack {
                menu_bar {
                  menu("File Example") {
                    menu_button("Open") { alert("o") }
        Severity: Minor
        Found in samples/test.rb - About 1 hr to fix

          Method expose has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def expose(cv,ctx)
              ssize= size()
              @cv.set_size_request(ssize.first-2,ssize.last-2)
              cx,cy=ssize.first/2,ssize.last/2
              cy=cx if cy>cx
          Severity: Minor
          Found in samples/gadget_clock.rb - About 1 hr to fix

            Method dialog_minmax has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def dialog_minmax(wbutton,h,value)
                f1=DynVar.new(h[:param1])
                f2=DynVar.new(h[:param2])
                ok=dialog_async("Saisie Seuils #{h['name']}", response: proc {
                  if f1.value<f2.value
            Severity: Minor
            Found in samples/gadget_trading.rb - About 1 hr to fix

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

                def anim(n,&blk)
                  @hTimer||={}
                  $on=false
                  px=0
                  px=GLib::Timeout.add(n) do
              Severity: Minor
              Found in lib/ruiby_gtk/ruiby_threader.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 select_mouse_up has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def select_mouse_up(e)   
                    if @lasso
                      @lasso.order
                      l=find_into_bbox(*@lasso.lpoints.flatten)
                      l=find_cover_bbox(*@lasso.lpoints.flatten) if l.size==0
              Severity: Minor
              Found in samples/draw.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_entry has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                def _dyn_entry(var,size,options,slotied) 
                  size= var.value.to_s.size*2 unless size
                  w= unless slotied
                    (block_given? ? entry(var.value,size,options)  : entry(var.value,size,options) { |v| var.value=v })
                  else
              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 calendar has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                def calendar(time=Time.now,options={})
                  c = Calendar.new
                  #c.display_options(Calendar::SHOW_HEADING | Calendar::SHOW_DAY_NAMES |  
                  #        Calendar::SHOW_WEEK_NUMBERS )
                  after(1) { c.signal_connect("day-selected") { |w,e| options[:selection].call(w.day)  rescue error($!) } } if options[:selection]
              Severity: Minor
              Found in lib/ruiby_gtk/ruiby_dsl3.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 entry has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                def entry(value,size=10,option={},&blk)
                  if DynVar === value
                     return _dyn_entry(value,size,option,false,&blk)       
                  end
                  w=Entry.new().tap {|e| e.set_text(value ? value.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 gui_invoke_wait has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

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

                def dialog_async(title,config={},&b) 
                  dialog = Dialog.new(
                    title:   title,
                    parent:  self,
                    buttons: [[Gtk::Stock::OK, :accept],
              Severity: Minor
              Found in lib/ruiby_gtk/dsl/layouts.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

              Severity
              Category
              Status
              Source
              Language