raubarede/Ruiby

View on GitHub
lib/ruiby_gtk/ruiby_dsl3.rb

Summary

Maintainability
C
1 day
Test Coverage

Method properties has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  def properties(title,hash,options={:edit=>false, :scroll=>[0,0]})
    if ! defined?(@prop_index)
      @prop_index=0
      @prop_hash={}
    else
Severity: Minor
Found in lib/ruiby_gtk/ruiby_dsl3.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

File ruiby_dsl3.rb has 281 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_relative 'ruiby_default_dialog3.rb'
module Ruiby_dsl
  include ::Gtk
  include ::Ruiby_default_dialog
end
Severity: Minor
Found in lib/ruiby_gtk/ruiby_dsl3.rb - About 2 hrs to fix

    Method properties has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def properties(title,hash,options={:edit=>false, :scroll=>[0,0]})
        if ! defined?(@prop_index)
          @prop_index=0
          @prop_hash={}
        else
    Severity: Major
    Found in lib/ruiby_gtk/ruiby_dsl3.rb - About 2 hrs to fix

      Method video has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def video(url=nil,w=300,h=200) 
          begin 
          require "gst"
          require "clutter-gtk"  # gem install clutter-gtk
          require "clutter-gst"  # gem install clutter-gstreamer
      Severity: Minor
      Found in lib/ruiby_gtk/ruiby_dsl3.rb - About 1 hr to fix

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

          def apply_options(w,options)
              w.set_size_request(*options[:size])                                 if options[:size] 
              w.set_border_width(options[:margins])                               if options[:margins]  
              w.width_request=(options[:width].to_i)                              if options[:width]
              w.height_request=(options[:height].to_i)                            if options[:height]
        Severity: Minor
        Found in lib/ruiby_gtk/ruiby_dsl3.rb - About 55 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 video has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

          def video(url=nil,w=300,h=200) 
            begin 
            require "gst"
            require "clutter-gtk"  # gem install clutter-gtk
            require "clutter-gst"  # gem install clutter-gstreamer
        Severity: Minor
        Found in lib/ruiby_gtk/ruiby_dsl3.rb - About 55 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 get_config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          def get_config(w)
            return({"nil"=>""}) unless w && w.class.respond_to?("properties")
            w.class.properties().inject({"class"=>w.class.to_s}) { |h,meth| 
              data=(w.send(meth) rescue nil)
              h[meth]=data.inspect.gsub(/^#/,'')[0..32]  if data 
        Severity: Minor
        Found in lib/ruiby_gtk/ruiby_dsl3.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

        There are no issues that match your filters.

        Category
        Status