AndyObtiva/glimmer-dsl-swt

View on GitHub

Showing 235 of 401 total issues

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

require 'glimmer/swt/properties'
require 'glimmer/swt/swt_proxy'
require 'glimmer/swt/display_proxy'
require 'glimmer/swt/color_proxy'
require 'glimmer/swt/font_proxy'
Severity: Major
Found in lib/glimmer/swt/custom/shape.rb - About 3 days to fix

    File widget_proxy.rb has 1044 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'glimmer/swt/widget_listener_proxy'
    require 'glimmer/swt/color_proxy'
    require 'glimmer/swt/font_proxy'
    require 'glimmer/swt/swt_proxy'
    require 'glimmer/swt/display_proxy'
    Severity: Major
    Found in lib/glimmer/swt/widget_proxy.rb - About 2 days to fix

      Class Shape has 121 methods (exceeds 20 allowed). Consider refactoring.
      Open

            class Shape
              include Properties
              
              DropEvent = Struct.new(:doit, :x, :y, :dragged_shape, :dragged_shape_original_x, :dragged_shape_original_y, :dragging_x, :dragging_y, :drop_shapes, keyword_init: true)
              
      Severity: Major
      Found in lib/glimmer/swt/custom/shape.rb - About 2 days to fix

        File hello_canvas_data_binding.rb has 770 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'glimmer-dsl-swt'
        
        class HelloCanvasDataBinding
          class PathShape
            attr_accessor :foreground_red, :foreground_green, :foreground_blue, :line_width_value, :line_style_value
        Severity: Major
        Found in samples/hello/hello_canvas_data_binding.rb - About 1 day to fix

          File scaffold.rb has 617 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'fileutils'
          require 'os'
          require 'facets/string/titlecase'
          
          # TODO refactor to nest under RakeTask namespace
          Severity: Major
          Found in lib/glimmer/rake_task/scaffold.rb - About 1 day to fix

            Method code_text_widget has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
            Open

                    def code_text_widget
                      @styled_text_proxy = styled_text(@swt_style) {
            #             custom_widget_property_owner # TODO implement to route properties here without declaring method_missing
                        layout_data :fill, :fill, true, true if lines
                        
            Severity: Minor
            Found in lib/glimmer/swt/custom/code_text.rb - About 1 day 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_property_arg_conversions has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
            Open

                    def apply_property_arg_conversions(property, args)
                      method_name = attribute_setter(property)
                      args = args.dup
                      the_java_method = org.eclipse.swt.graphics.GC.java_class.declared_instance_methods.detect {|m| m.name == method_name}
                      return args if the_java_method.nil?
            Severity: Minor
            Found in lib/glimmer/swt/custom/shape.rb - About 1 day 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 WidgetProxy has 62 methods (exceeds 20 allowed). Consider refactoring.
            Open

                class WidgetProxy
                  include Packages
                  include ProxyProperties
                  include Custom::Drawable
            
            
            Severity: Major
            Found in lib/glimmer/swt/widget_proxy.rb - About 1 day to fix

              File table_proxy.rb has 537 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'glimmer/swt/widget_proxy'
              
              module Glimmer
                module SWT
                  class TableProxy < Glimmer::SWT::WidgetProxy
              Severity: Major
              Found in lib/glimmer/swt/table_proxy.rb - About 1 day to fix

                Method widget_property_listener_installers has 221 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def widget_property_listener_installers
                        @swt_widget_property_listener_installers ||= {
                          Java::OrgEclipseSwtWidgets::Control => {
                            :focus => lambda do |observer|
                              on_focus_gained { |focus_event|
                Severity: Major
                Found in lib/glimmer/swt/widget_proxy.rb - About 1 day to fix

                  Method edit_table_item has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def edit_table_item(table_item, column_index, before_write: nil, after_write: nil, after_cancel: nil, write_on_cancel: false)
                          return if table_item.nil?
                          model = table_item.data
                          property = column_properties[column_index]
                          cancel_edit!
                  Severity: Minor
                  Found in lib/glimmer/swt/table_proxy.rb - About 1 day 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 editors has 185 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          def editors
                            @editors ||= {
                              # ensure editor can work with string keys not just symbols (leave one string in for testing)
                              'text' => {
                                widget_value_property: :text,
                  Severity: Major
                  Found in lib/glimmer/swt/table_proxy.rb - About 7 hrs to fix

                    Method set_attribute has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def set_attribute(attribute_name, *args)
                              options = args.last if args.last.is_a?(Hash)
                              args.pop if !options.nil? && !options[:redraw].nil?
                              options ||= {}
                              perform_redraw = @perform_redraw
                    Severity: Minor
                    Found in lib/glimmer/swt/custom/shape.rb - About 7 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 native has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                    Open

                            def native(native_type=nil, native_extra_args)
                              puts "Generating native executable with jpackage..."
                              java_version = `jruby -v`
                              if java_version.include?(JDK_VERSION)
                                puts "Java Version #{JDK_VERSION} Detected!"
                    Severity: Minor
                    Found in lib/glimmer/rake_task/package.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

                    File hello_tree.rb has 414 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require 'glimmer-dsl-swt'
                    
                    class HelloTree
                      EMPLOYEE_ATTRIBUTES = [
                        :first_name, :last_name, :position, :salary,
                    Severity: Minor
                    Found in samples/hello/hello_tree.rb - About 5 hrs to fix

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

                              def handle_observation_request(observation_request, source_observation_request: nil, &block)
                                if observation_request.to_s == 'on_shape_disposed'
                                  @on_shape_disposed_handlers ||= []
                                  @on_shape_disposed_handlers << block
                                  return ShapeListenerProxy.new(shape: self, drawable: drawable, shape_listener_block: block, observation_request: 'on_shape_disposed')
                      Severity: Minor
                      Found in lib/glimmer/swt/custom/shape.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 initialize has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def initialize(*args, swt_widget: nil)
                              auto_exec do
                                if swt_widget
                                  @swt_widget = swt_widget
                                else
                      Severity: Minor
                      Found in lib/glimmer/swt/shell_proxy.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 property_type_converters has 137 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def property_type_converters
                              color_converter = lambda do |value|
                                if value.is_a?(Symbol) || value.is_a?(String)
                                  ColorProxy.new(value).swt_color
                                elsif value.is_a?(RGB)
                      Severity: Major
                      Found in lib/glimmer/swt/widget_proxy.rb - About 5 hrs to fix

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

                              def call(*args)
                                options = args.last.is_a?(Hash) ? args.pop : {}
                                internal_sort = options[:internal_sort] || false
                                new_model_collection = args.first
                                Glimmer::SWT::DisplayProxy.instance.auto_exec(override_sync_exec: @model_binding.binding_options[:sync_exec], override_async_exec: @model_binding.binding_options[:async_exec]) do
                        Severity: Minor
                        Found in lib/glimmer/data_binding/table_items_binding.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 custom_shell_file has 131 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                def custom_shell_file(custom_shell_name, namespace, shell_type, shell_options = {})
                                  namespace_type = class_name(namespace) == class_name(current_dir_name) ? 'class' : 'module'
                            
                                  custom_shell_file_content = <<-MULTI_LINE_STRING
                        #{namespace_type} #{class_name(namespace)}
                        Severity: Major
                        Found in lib/glimmer/rake_task/scaffold.rb - About 5 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language