AndyObtiva/glimmer-dsl-libui

View on GitHub

Showing 156 of 312 total issues

Method draw has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

      def draw(area_draw_params)
        @start = ::LibUI.attributed_string_len(@parent_proxy.attributed_string)
        ::LibUI.attributed_string_append_unattributed(@parent_proxy.attributed_string, @string)
        unless color.nil?
          color_attribute = ::LibUI.new_color_attribute(@color[:r].to_f / 255.0, @color[:g].to_f / 255.0, @color[:b].to_f / 255.0, @color[:a] || 1.0)
Severity: Minor
Found in lib/glimmer/libui/attributed_string.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 send_to_libui has a Cognitive Complexity of 26 (exceeds 5 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 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 custom_window_file has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

        def custom_window_file(custom_window_name, namespace, window_type, window_options = {})
          window_options ||= {}
          window_options[:custom_window_class_name] ||= 'CustomWindow'
          namespace_type = class_name(namespace) == class_name(current_dir_name) ? 'class' : 'module'
    
Severity: Minor
Found in lib/glimmer/rake_task/scaffold.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 interpret_color has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

      def interpret_color(value)
        if value.is_a?(Array) && value.last.is_a?(Hash)
          options = value.last
          value = value[0...-1]
        end
Severity: Minor
Found in lib/glimmer/libui.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 boolean_to_integer has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

      def boolean_to_integer(bool, allow_nil: true, allow_integer: true)
        bool.nil? ? (allow_nil ? nil : 0) : (allow_integer && bool.is_a?(Integer) ? bool : (bool.is_a?(TrueClass) || bool.is_a?(FalseClass) ? (bool == true ? 1 : 0) : (allow_nil ? nil : 0)))
      end
Severity: Minor
Found in lib/glimmer/libui.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 launch has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def launch
    window('Michael Ende (1929-1995) The Neverending Story', 600, 500) {
      margined true
      
      vertical_box {
Severity: Major
Found in examples/custom_draw_text.rb - About 3 hrs to fix

    Class Scaffold has 28 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Scaffold
          class << self
            include FileUtils
        
            VERSION = File.read(File.expand_path('../../../../VERSION', __FILE__)).strip
    Severity: Minor
    Found in lib/glimmer/rake_task/scaffold.rb - About 3 hrs to fix

      Class Tetromino has 28 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class Tetromino
            ORIENTATIONS = [:north, :east, :south, :west]
            
            LETTER_COLORS = {
              I: :cyan,
      Severity: Minor
      Found in examples/tetris/model/tetromino.rb - About 3 hrs to fix

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

          def launch
            window('Contacts', 600, 600) {
              margined true
              
              vertical_box {
        Severity: Major
        Found in examples/form_table3.rb - About 3 hrs to fix

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

            def launch
              window('Contacts', 600, 600) {
                margined true
                
                vertical_box {
          Severity: Major
          Found in examples/form_table2.rb - About 3 hrs to fix

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

              def launch
                window('Contacts', 600, 600) {
                  margined true
                  
                  vertical_box {
            Severity: Major
            Found in examples/form_table4.rb - About 3 hrs to fix

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

                def launch
                  window('Contacts', 600, 600) {
                    margined true
                    
                    vertical_box {
              Severity: Major
              Found in examples/form_table.rb - About 3 hrs to fix

                Method table_paginator has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                Open

                        def table_paginator
                          horizontal_box {
                            stretchy false
                            
                            button('<<') {
                Severity: Minor
                Found in lib/glimmer/libui/custom_control/refined_table.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 time has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                        def time(value = nil)
                          @time ||= ::LibUI::FFI::TM.malloc
                          ::LibUI.date_time_picker_time(@libui, @time)
                          if value.nil?
                            {
                Severity: Minor
                Found in lib/glimmer/libui/control_proxy/date_time_picker_proxy.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

                Class TextProxy has 25 methods (exceeds 20 allowed). Consider refactoring.
                Open

                      class TextProxy < ControlProxy
                        include Parent
                        include PerfectShaped
                        prepend Transformable
                        
                Severity: Minor
                Found in lib/glimmer/libui/control_proxy/text_proxy.rb - About 2 hrs to fix

                  Method integer_to_boolean has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def integer_to_boolean(int, allow_nil: true, allow_boolean: true)
                          int.nil? ? (allow_nil ? nil : false) : (allow_boolean && (int.is_a?(TrueClass) || int.is_a?(FalseClass)) ? int : (int.is_a?(Integer) ? int == 1 : (allow_nil ? nil : false)))
                        end
                  Severity: Minor
                  Found in lib/glimmer/libui.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

                  Method install_listeners has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def install_listeners
                            unless @listeners_installed
                              @area_handler.Draw         = fiddle_closure_block_caller(0, [1, 1, 1]) do |_, _, area_draw_params|
                                area_draw_params = ::LibUI::FFI::AreaDrawParams.new(area_draw_params)
                                area_draw_params = area_draw_params_hash(area_draw_params)
                  Severity: Major
                  Found in lib/glimmer/libui/control_proxy/area_proxy.rb - About 2 hrs to fix

                    Method custom_window_gem has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            def custom_window_gem(custom_window_name, namespace)
                              gem_name = "glimmer-libui-cw-#{custom_window_name.underscore}"
                              gem_summary = "#{human_name(custom_window_name)} - Glimmer Custom Window"
                              begin
                                custom_window_keyword = dsl_control_name(custom_window_name)
                    Severity: Major
                    Found in lib/glimmer/rake_task/scaffold.rb - About 2 hrs to fix

                      File tetromino.rb has 271 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      require_relative 'block'
                      
                      require 'matrix'
                      
                      class Tetris
                      Severity: Minor
                      Found in examples/tetris/model/tetromino.rb - About 2 hrs to fix

                        File shape.rb has 267 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require 'glimmer/libui/parent'
                        require 'glimmer/libui/control_proxy/area_proxy'
                        require 'glimmer/libui/control_proxy/path_proxy'
                        require 'glimmer/libui/data_bindable'
                        require 'glimmer/libui/perfect_shaped'
                        Severity: Minor
                        Found in lib/glimmer/libui/shape.rb - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language