raubarede/Ruiby

View on GitHub

Showing 263 of 263 total issues

File gemstat.rb has 2731 lines of code (exceeds 250 allowed). Consider refactoring.
Open

$authors= %w{wycats markbates jimweirich} # seems the most productives...
$authors1= %w{rdaubarede}

LOCAL_HTDOCS="d:/usr/"
RUBYGEMS="http://rubygems.org" 
Severity: Major
Found in tmp/gemstat.rb - About 1 wk to fix

    File draw.rb has 834 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    puts "Not terminted !!!!!"
    
    require_relative '../lib/ruiby'
    
    ############################### Complete ruiby dsl for vector widget
    Severity: Major
    Found in samples/draw.rb - About 2 days to fix

      Method canvas has 308 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def canvas(width,height,option={})
          autoslot()
          cv=DrawingArea.new()
          cv.width_request=width
          cv.height_request=height
      Severity: Major
      Found in lib/ruiby_gtk/dsl/canvas.rb - About 1 day to fix

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

        module Carto
          def radians(degrees) (Math::PI * degrees) / 180.0 end
          def degrees(radians) (radians * 180.0) / Math::PI end
          def tile_nums_2_lonlat(xtile, ytile, zoom)
            factor = 2.0 ** (zoom)
        Severity: Major
        Found in samples/tilesviewer.rb and 1 other location - About 1 day to fix
        samples/aerial_viewer.rb on lines 89..133

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

        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

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

        module Carto
          def radians(degrees) (Math::PI * degrees) / 180.0 end
          def degrees(radians) (radians * 180.0) / Math::PI end
          def tile_nums_2_lonlat(xtile, ytile, zoom)
            factor = 2.0 ** (zoom)
        Severity: Major
        Found in samples/aerial_viewer.rb and 1 other location - About 1 day to fix
        samples/tilesviewer.rb on lines 86..130

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

        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

        File gadget_trading.rb has 465 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'json'
        require 'httpclient'
        require 'yahoo-finance'
        require 'Ruiby'                       unless Dir.exists?("../lib/ruiby_dsl")
        require_relative '../lib/Ruiby.rb' if Dir.exists?("../lib/ruiby_dsl")
        Severity: Minor
        Found in samples/gadget_trading.rb - About 7 hrs to fix

          File test.rb has 464 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          $time_start=Time.now.to_f*1000
          $mlog=[]
          def mlog(text)
           delta=(Time.now.to_f*1000-$time_start).to_i
           $mlog << [delta,text]
          Severity: Minor
          Found in samples/test.rb - About 7 hrs to fix

            Method component has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
            Open

              def component()
                stack do
                #------------ title + entry
                stacki do
                  flow do
            Severity: Minor
            Found in samples/benchi.rb - About 6 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

            Method plot has 151 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def plot(width,height,curves,config={})
                 plot=canvas(width,height) do
                   on_canvas_draw { |w,ctx| w.expose(w,ctx) }
                   on_canvas_button_press { |w,event| w.track(event)}
                 end
            Severity: Major
            Found in lib/ruiby_gtk/dsl/plot.rb - About 6 hrs to fix

              Method ruiby_require has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
              Open

                def ruiby_require(*gems)
                  w=nil
                  gems=gems.map {|g| g.split(/\s+/)}.flatten
                  gems.each do|gem| 
                    begin
              Severity: Minor
              Found in lib/Ruiby.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 canvas.rb has 412 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module Ruiby_dsl
                
                # Create a drawing area, for pixel/vectoriel draw
                # for interactive actions see test.rb fo little example.
                #
              Severity: Minor
              Found in lib/ruiby_gtk/dsl/canvas.rb - About 5 hrs to fix

                Class VCanvas_editable has 43 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class VCanvas_editable < VCanvas
                    def initialize(win,w,h,options)
                      super
                      @current=nil
                      @select={}
                Severity: Minor
                Found in samples/draw.rb - About 5 hrs to fix

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

                  class CacheTiles
                    DIR="#{Dir.tmpdir}/atiles"
                    TMPZ="#{DIR}/ZOOM"
                    TMPZL="#{TMPZ}/LON"
                    TMP="#{TMPZL}/LAT.jpg"
                  Severity: Major
                  Found in samples/aerial_viewer.rb and 1 other location - About 5 hrs to fix
                  samples/tilesviewer.rb on lines 18..58

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

                  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

                  class CacheTiles
                    DIR="#{Dir.tmpdir}/tiles"
                    TMPZ="#{DIR}/ZOOM"
                    TMPZL="#{TMPZ}/LON"
                    TMP="#{TMPZL}/LAT.jpg"
                  Severity: Major
                  Found in samples/tilesviewer.rb and 1 other location - About 5 hrs to fix
                  samples/aerial_viewer.rb on lines 21..61

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

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

                    def canvasOld(width,height,option={})
                      puts "*** DEPRECATED: use canvas do end in place of canvasOld ***"
                      autoslot()
                      w=DrawingArea.new()
                      w.width_request=width
                  Severity: Minor
                  Found in lib/ruiby_gtk/dsl/canvas.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

                  Method game has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def game()
                      mat2=@oldmat
                      MAXC.times do |col| MAXL.times do |li|
                            poids= 0; n=0
                            [-1, 0, 1].each { |col_off| [-1, 0, 1].each { |li_off|
                  Severity: Minor
                  Found in samples/gol2.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

                  Method bench has 131 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def bench(code)
                       begin
                          eval( "class Test ; def self.test()  #{([code]*100).join(" ; ")} ;  end ; end ",$global)
                          __i=0
                          istep=100 # number of Test.test() in the while()
                  Severity: Major
                  Found in samples/benchi.rb - About 5 hrs to fix

                    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

                    Method run has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def run(wspy,wtarget,stempo,str_size) 
                      tempo= (stempo.size>0) ? (stempo.to_f)/1000.0 : nil
                      tr_size=(str_size.size>0) ? str_size.to_i : nil
                      tempo=22 if tr_size && ! tempo
                      raise("missing proxy port number") if wspy[:port].text.size==0 || wspy[:port].text.to_i<=0
                    Severity: Minor
                    Found in samples/spygui.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

                    Method game has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def game()
                        mat2=@oldmat
                        MAXC.times do |col| MAXL.times do |li|
                              nb_neighboring= 0
                              [-1, 0, 1].each { |col_off| [-1, 0, 1].each { |li_off|
                    Severity: Minor
                    Found in samples/gol.rb - About 4 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

                    Severity
                    Category
                    Status
                    Source
                    Language