raubarede/Ruiby

View on GitHub
lib/ruiby_gtk/dsl/form_fields.rb

Summary

Maintainability
D
2 days
Test Coverage

Method _radio_buttons has a Cognitive Complexity of 34 (exceeds 5 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 5 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

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

        def _dyn_toggle_button(text1,text2,var,option={},&blk)
          text2 = "- "+text1 unless text2
          b=ToggleButton.new(label: text1);
          b.signal_connect("clicked") do |w,e| 
            w.label= w.active?() ? text2.to_s : text1.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 _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 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 _dyn_ientry has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def _dyn_ientry(var,options,slotied) 
          w= unless slotied
            (block_given? ? ientry(var.value,options)  : ientry(var.value,options) { |v| var.value=v })
          else
            (block_given? ? ientry(var.value,options)  : ientry(var.value,options) { |v| var.value=v })
      Severity: Minor
      Found in lib/ruiby_gtk/dsl/form_fields.rb - About 45 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 combo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def combo(choices,default=nil,option={},&blk)
          # TODO Dyn
          w=ComboBoxText.new()
          choices=choices.inject({}) { |h,k| 
            h[k]=h.size
      Severity: Minor
      Found in lib/ruiby_gtk/dsl/form_fields.rb - About 45 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 islider has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def islider(value=0,option={},&b)
          if DynVar === value
            return _dyn_islider(value,option,&b)
          end
          w=Scale.new(:horizontal,(option[:min]||0).to_i,(option[:max]||100).to_i,option[:by]||1)
      Severity: Minor
      Found in lib/ruiby_gtk/dsl/form_fields.rb - About 45 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 panel_progress has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

       def panel_progress(text="",&blk) 
           dvar= ::DynVar.new(0)
           lw=nil
           d=panel_async("Progression...") {
               lw=label text if text && text.size >0
      Severity: Minor
      Found in lib/ruiby_gtk/dsl/form_fields.rb - About 45 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 toggle_button has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def toggle_button(text1,text2=nil,value=false,option={},&blk)
      Severity: Minor
      Found in lib/ruiby_gtk/dsl/form_fields.rb - About 35 mins to fix

        Method field has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def field(tlabel,lwidth,value,option={},&blk)
        Severity: Minor
        Found in lib/ruiby_gtk/dsl/form_fields.rb - About 35 mins to fix

          Method _dyn_toggle_button has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def _dyn_toggle_button(text1,text2,var,option={},&blk)
          Severity: Minor
          Found in lib/ruiby_gtk/dsl/form_fields.rb - About 35 mins to fix

            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 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

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

              def check_button(text="",value=false,option={},&blk)
                if DynVar === value
                  return _dyn_check_button(text,value,option)
                end
                b=CheckButton.new(text)
            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 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

            There are no issues that match your filters.

            Category
            Status