raubarede/Ruiby

View on GitHub

Showing 263 of 263 total issues

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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                   framei("Stoked ObjectBinding",margins: 20) {
                     flowi { labeli "adresse : " ,width: 200;  entry l2.adresse  }
                     flowi { labeli "ville : ",width: 200 ;  entry l2.ville      }
                     flowi { 
                       regular
            Severity: Major
            Found in samples/dyn.rb and 1 other location - About 1 hr to fix
            samples/dyn.rb on lines 64..69

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 51.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                   framei("ObjectBinding",margins: 20) {
                     flowi { labeli "adresse : " ,width: 200;  entry l1.adresse}
                     flowi { labeli "ville : ",width: 200 ;  entry l1.ville}
                     flowi { regular
                       button(" Validation ") { alert l1.to_h }
            Severity: Major
            Found in samples/dyn.rb and 1 other location - About 1 hr to fix
            samples/dyn.rb on lines 74..80

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 51.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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

            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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                def fill(li,color="#000000",ep=2)
                  color=Ruiby.cv_color_html(color)
                  $ctx.set_line_width(ep)
                  $ctx.set_source_rgba(color.red/65000.0, color.green/65000.0, color.blue/65000.0, 1)
                  pt0,*poly=*li
              Severity: Major
              Found in samples/canvas.rb and 1 other location - About 1 hr to fix
              samples/canvas.rb on lines 161..168

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 49.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                def line(li,color="#000000",ep=2)
                  color=Ruiby.cv_color_html(color)
                  $ctx.set_line_width(ep)
                  $ctx.set_source_rgba(color.red/65000.0, color.green/65000.0, color.blue/65000.0, 1)
                  pt0,*poly=*li
              Severity: Major
              Found in samples/canvas.rb and 1 other location - About 1 hr to fix
              samples/canvas.rb on lines 170..177

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 49.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                      button("Goto...") { 
                        prompt("Longitude ?",@lon0.to_s) { |lon|  
                          prompt("Latitude  ?",@lat0.to_s) { |lat| 
                            if ask("#{lon.to_f} ; #{lat.to_f}\n Validation ?")
                              @lonRef,@latRef=lon.to_f,lat.to_f
                Severity: Minor
                Found in samples/aerial_viewer.rb and 1 other location - About 1 hr to fix
                samples/tilesviewer.rb on lines 157..166

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 47.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Severity
                Category
                Status
                Source
                Language