raubarede/Ruiby

View on GitHub

Showing 209 of 263 total issues

Method formula has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def formula(opoids,poids)
         #--#
     opoids>30 ?  (opoids<82 ? (poids*1.0003) : poids*0.99 ) : ((opoids<10 && opoids>1) ? (100-poids/2) : (poids*0.93))
         #--#
    end
Severity: Minor
Found in samples/gol2.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_chooser has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def dialog_chooser(title, action, button)
      if Ruiby.gtk_version(3)
        dialog = Gtk::FileChooserDialog.new(
            :title => title, 
            :parent => self, 
Severity: Minor
Found in lib/ruiby_gtk/ruiby_default_dialog3.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_chooser has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def dialog_chooser(title, action, button)
      if Ruiby.gtk_version(3)
        dialog = Gtk::FileChooserDialog.new(
            :title => title, 
            :parent => self, 
Severity: Minor
Found in lib/ruiby_gtk/ruiby_default_dialog.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 initialize has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize(window,title="title?",config,x0,y0)
  $statusIcon=self
  @popup_tray=Menu.new
  @checkMenu={}
  file= (config[:icon] && File.exist?(config[:icon])) ? config[:icon] : nil
Severity: Minor
Found in lib/ruiby_gtk/systray.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 test_list_grid has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def test_list_grid()
      flow {
        stack {
          frame("CB on List") {
            stacki{
Severity: Minor
Found in samples/test.rb - About 1 hr to fix

    Method test_canvas has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def test_canvas()
         flow do
            stack do
              button("Color") {
                @color=ask_color()
    Severity: Minor
    Found in samples/test.rb - About 1 hr to fix

      Method threader has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        def threader(per)
          return unless $__mainwindow__==self
          @queue=Queue.new
          $__queue__=@queue
          ici=self
      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 push_data has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        def push_data(h)
          h.each_with_index {|(k,v),i| 
            next unless Hash === v
            begin
              @lcurve[k]=[[100]*150,[100]*150] unless @lcurve[k] && @lcurve[k].size==2
      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 component has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def component()
            stack do
                if ed=source_editor()
                  @edit=slot(ed).editor
                  @edit.buffer.text=File.exists?(@filename) ? File.read(@filename) : @filename
      Severity: Minor
      Found in lib/ruiby_gtk/editor.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 run_window has a Cognitive Complexity of 14 (exceeds 5 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: Minor
      Found in samples/pipeplot.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 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def component()
            stack do
              flow {
                  stacki { space;_button_list;space } if @options["button-orrient"] =~ /^l/i
                  @grid=grid(@captions,100,150)
      Severity: Minor
      Found in lib/ruiby_gtk/editor.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 do_special_actions has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def do_special_actions()
          10.times { |i| log("#{i} "+ ("*"*(i+1))) }
          dialog("Dialog tests") do
            stack do
              labeli "  alert, prompt, file chosser and log  "
      Severity: Minor
      Found in samples/test.rb - About 1 hr to fix

        Method component has 43 lines of code (exceeds 25 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 1 hr to fix

          Method initialize has 43 lines of code (exceeds 25 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 1 hr to fix

            Method _radio_buttons has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def _radio_buttons(sens,ltext=["empty!"],value=-1,&blk)
                is_dyn = (DynVar === value)
                b0=nil
                s=var_box(sens,{},false) {
                  ltext.each_with_index {|txt,i|
            Severity: Minor
            Found in lib/ruiby_gtk/dsl/form_fields.rb - About 1 hr to fix

              Method initialize has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def initialize(window,title="title?",config,x0,y0)
                $statusIcon=self
                @popup_tray=Menu.new
                @checkMenu={}
                file= (config[:icon] && File.exist?(config[:icon])) ? config[:icon] : nil
              Severity: Minor
              Found in lib/ruiby_gtk/systray.rb - About 1 hr to fix

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

                  def expose(cv,ctx)
                    ssize=cv.get_size_request()
                    ############## Liste
                    @cv.draw_rectangle(0,0,ssize.first,ssize.last,0,nil,"#888",0)
                    @cv.draw_rectangle(2,2,ssize.first-4,ssize.last-4,15,"#555",$BG,3)
                Severity: Minor
                Found in samples/gadget.rb - About 1 hr to fix

                  Method grid has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def 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 1 hr to fix

                    Method toggle_button has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def toggle_button(text1,text2=nil,value=false,option={},&blk)
                        if DynVar === value
                          return _dyn_toggle_button(text1,text2,value,option,&blk)
                        end
                        text2 = "- "+text1 unless text2
                    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 exec has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def exec(l)
                        @stop=false
                        l.each_with_index do |s,index| 
                          gui_invoke {  @list.set_selection(index) }
                          timeout(10) {
                    Severity: Minor
                    Found in samples/all.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