raubarede/Ruiby

View on GitHub

Showing 263 of 263 total issues

Method feed_update has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

def feed_update(win,st,url) 
  return unless url && url.size>0
  #win.set_title(url.gsub(/https?:\/\//,""))
  gui_invoke { gui_invoke { win.clear(st) } }
  rss = SimpleRSS.parse open(url)
Severity: Minor
Found in samples/feeds.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

File benchi.rb has 344 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_relative '../lib/Ruiby'
require 'timeout'

$global=binding
class Test ; def self.test() 1  end ; end
Severity: Minor
Found in samples/benchi.rb - About 4 hrs to fix

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

    def get_update(app)
      return if Thread.list.size>2
      Thread.new {
        now=Time.now
        if  $first || $fr_ouverture.member?(Time.now.hour)
    Severity: Minor
    Found in samples/gadget_trading.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

    Method component has 99 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def component()
        stack do
          a=slot(Image.new( :stock => Gtk::Stock::OPEN, :size => :button))
          sloti(htoolbar do
            toolbar_button("open","ouvrir fichier") {
    Severity: Major
    Found in samples/ex.rb - About 3 hrs to fix

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

      module Tools  
        CROSSGAP=8
        def draw_tile(ctx,f,x,y,pdx,pdy)
          ctx.set_source_pixbuf(get_pixbuf(f),(x-pdx)*256,(y-pdy)*256)
          ctx.paint
      Severity: Major
      Found in samples/aerial_viewer.rb and 1 other location - About 3 hrs to fix
      samples/tilesviewer.rb on lines 61..81

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

      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 Tools  
        CROSSGAP=8
        def draw_tile(ctx,f,x,y,pdx,pdy)
          ctx.set_source_pixbuf(get_pixbuf(f),(x-pdx)*256,(y-pdy)*256)
          ctx.paint
      Severity: Major
      Found in samples/tilesviewer.rb and 1 other location - About 3 hrs to fix
      samples/aerial_viewer.rb on lines 64..84

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

      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 component has a Cognitive Complexity of 25 (exceeds 5 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 3 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 track has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

           def plot.track(event)
            return unless @config[:tracker]
            x=nil
            lt=@curves.each_with_object([]) {|(name,d),a|
              next unless d[:type]==:curve
      Severity: Minor
      Found in lib/ruiby_gtk/dsl/plot.rb - About 3 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 component has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def component()
          stack do
          #------------ title + entry
          stacki do
            flow do
      Severity: Major
      Found in samples/benchi.rb - About 3 hrs to fix

        Method expose has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

             def plot.expose(w,ctx) 
                return unless @curves
                w.draw_rectangle(0,0,@config[:w],@config[:h],0,nil,@config[:bg],0) if @config[:bg]
                if @config[:grid] 
                  dx=dy=(@config[:grid]||"40").to_i
        Severity: Minor
        Found in lib/ruiby_gtk/dsl/plot.rb - About 3 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 layouts.rb has 308 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module Ruiby_dsl
          
          ############################ Slot : H/V Box or Frame
        
          # container : vertical box, take all space available, sloted in parent by default
        Severity: Minor
        Found in lib/ruiby_gtk/dsl/layouts.rb - About 3 hrs to fix

          Method run_window has 83 lines of code (exceeds 25 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: Major
          Found in samples/pipeplot.rb - About 3 hrs to fix

            Method component has 82 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def component()          
                stack do
                  ################## Menu
                  menu_bar do
                    menu("File") {
            Severity: Major
            Found in samples/draw.rb - About 3 hrs to fix

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

                def component()
                  stack do
                    htoolbar do
                      toolbar_button("open","ouvrir fichier") {
                        load(ask_file_to_read(".","*.rb"))
              Severity: Minor
              Found in samples/editor.rb - About 3 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 dialog_icones has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                def dialog_icones
                  dialog "Ruiby Predefined icones" do
                      stack do
                        scrolled(400,500) { 
                          Gtk::IconTheme.default.icons.sort.map { |name|  
              Severity: Minor
              Found in samples/sketchi.rb - About 3 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

                Class VElem has 26 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class VElem
                    def initialize() @lpoints=[];@style={} end
                    def bbox()
                      @lpoints.inject(Bbox.new){ |bb,p| bb << [p[0],p[1]] }
                    end
                Severity: Minor
                Found in samples/draw.rb - About 3 hrs to fix

                  Method list has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def list(title,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: Major
                  Found in lib/ruiby_gtk/dsl/list_grid.rb - About 2 hrs to fix

                    Method tree_grid has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def tree_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: Major
                    Found in lib/ruiby_gtk/dsl/list_grid.rb - About 2 hrs to fix

                      Method initialize has a Cognitive Complexity of 21 (exceeds 5 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 2 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