AndyObtiva/glimmer-dsl-libui

View on GitHub

Showing 156 of 312 total issues

Method stroke has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

        def stroke(*args)
          args = args.first if args.size == 1 && (args.first.is_a?(Array) || args.first.is_a?(Hash) || args.first.is_a?(String) || args.first.is_a?(Symbol))
          if args.empty?
            @stroke ||= {}
          else
Severity: Minor
Found in lib/glimmer/libui/control_proxy/path_proxy.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 x has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

        def x(value = nil)
          if value.nil?
            @args.size > 3 ? @args[1] : (@options[:x] || 0)
          else
            if @args.size > 3
Severity: Minor
Found in lib/glimmer/libui/control_proxy/image_proxy.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 launch has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def launch
    window('Michael Ende (1929-1995) The Neverending Story', 600, 400) {
      margined true
      
      area {
Severity: Minor
Found in examples/basic_draw_text.rb - About 1 hr to fix

    Method setup_timer has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def setup_timer
        unless @setup_timer
          Glimmer::LibUI.timer(1) do
            if @started
              seconds = @sec
    Severity: Minor
    Found in examples/timer.rb - About 1 hr to fix

      Method custom_shape_gem has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def custom_shape_gem(custom_shape_name, namespace)
                gem_name = "glimmer-libui-cs-#{custom_shape_name.underscore}"
                gem_summary = "#{human_name(custom_shape_name)} - Glimmer Custom Shape"
                if namespace
                  gem_name += "-#{namespace.underscore}"
      Severity: Minor
      Found in lib/glimmer/rake_task/scaffold.rb - About 1 hr to fix

        Method custom_control_gem has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def custom_control_gem(custom_control_name, namespace)
                  gem_name = "glimmer-libui-cc-#{custom_control_name.underscore}"
                  gem_summary = "#{human_name(custom_control_name)} - Glimmer Custom Control"
                  if namespace
                    gem_name += "-#{namespace.underscore}"
        Severity: Minor
        Found in lib/glimmer/rake_task/scaffold.rb - About 1 hr to fix

          Method launch has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def launch
              window('Login') {
                margined true
                
                vertical_box {
          Severity: Minor
          Found in examples/login3.rb - About 1 hr to fix

            Method launch has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def launch
                window('Login') {
                  margined true
                  
                  vertical_box {
            Severity: Minor
            Found in examples/login.rb - About 1 hr to fix

              Method launch has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def launch
                  window('Login') {
                    margined true
                    
                    vertical_box {
              Severity: Minor
              Found in examples/login4.rb - About 1 hr to fix

                Method send_to_libui has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def send_to_libui(method_name, *args, &block)
                        if ::LibUI.respond_to?("#{libui_api_keyword}_#{method_name.to_s.sub(/\?$/, '')}") && args.empty?
                          property = method_name.to_s.sub(/\?$/, '')
                          value = ::LibUI.send("#{libui_api_keyword}_#{property}", libui, *args)
                          handle_string_property(property, handle_boolean_property(property, value))
                Severity: Minor
                Found in lib/glimmer/libui/control_proxy.rb - About 1 hr to fix

                  Method launch has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def launch
                      window('Login') {
                        margined true
                        
                        vertical_box {
                  Severity: Minor
                  Found in examples/login2.rb - About 1 hr to fix

                    Method init_draw_brush has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            def init_draw_brush(draw_brush, draw_brush_args)
                              if draw_brush_args[:r] || draw_brush_args[:g] || draw_brush_args[:b] || draw_brush_args[:a]
                                draw_brush_args[:type] ||= :solid
                              elsif draw_brush_args[:outer_radius]
                                draw_brush_args[:type] ||= :radial_gradient
                    Severity: Minor
                    Found in lib/glimmer/libui/control_proxy/path_proxy.rb - About 1 hr to fix

                      Method color has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def color(value = nil)
                                if value.nil?
                                  @red ||= Fiddle::Pointer.malloc(8) # double
                                  @green ||= Fiddle::Pointer.malloc(8) # double
                                  @blue ||= Fiddle::Pointer.malloc(8) # double
                      Severity: Minor
                      Found in lib/glimmer/libui/control_proxy/color_button_proxy.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 init_draw_brush has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def init_draw_brush(draw_brush, draw_brush_args)
                                if draw_brush_args[:r] || draw_brush_args[:g] || draw_brush_args[:b] || draw_brush_args[:a]
                                  draw_brush_args[:type] ||= :solid
                                elsif draw_brush_args[:outer_radius]
                                  draw_brush_args[:type] ||= :radial_gradient
                      Severity: Minor
                      Found in lib/glimmer/libui/control_proxy/path_proxy.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 load_image has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def load_image
                                require 'chunky_png'
                                canvas = nil
                                if file.start_with?('http')
                                  require 'net/http'
                      Severity: Minor
                      Found in lib/glimmer/libui/control_proxy/image_proxy.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 create_gui has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def create_gui
                          menu('Help') {
                            menu_item('Version') {
                              on_clicked do
                                show_version
                      Severity: Minor
                      Found in examples/midi_player3.rb - About 1 hr to fix

                        Method cube has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def cube(location_x: 0,
                                   location_y: 0,
                                   rectangle_width: nil,
                                   rectangle_height: nil,
                                   cube_height: nil,
                        Severity: Minor
                        Found in examples/basic_composite_shape.rb - About 1 hr to fix

                          Method for has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  def for(keyword)
                                    unless flyweight_custom_control_classes.keys.include?(keyword)
                                      begin
                                        extracted_namespaces = keyword.
                                          to_s.
                          Severity: Minor
                          Found in lib/glimmer/libui/custom_control.rb - About 1 hr to fix

                            Method launch has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def launch
                                window('Form') {
                                  margined true
                                  
                                  vertical_box {
                            Severity: Minor
                            Found in examples/form.rb - About 1 hr to fix

                              Method for has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      def for(keyword)
                                        unless flyweight_custom_shape_classes.keys.include?(keyword)
                                          begin
                                            extracted_namespaces = keyword.
                                              to_s.
                              Severity: Minor
                              Found in lib/glimmer/libui/custom_shape.rb - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language