AndyObtiva/glimmer-dsl-swt

View on GitHub

Showing 213 of 365 total issues

File shape.rb has 1242 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 1037 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 scaffold.rb has 620 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'fileutils'
        require 'os'
        require 'facets'
        
        # 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 65 (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

          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

            Class WidgetProxy has 61 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

              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

              File table_proxy.rb has 508 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 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 46 (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 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

                        Method constant has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                        Open

                                def constant(symbol)
                                  return symbol unless symbol.is_a?(Symbol) || symbol.is_a?(String)
                                  symbol_string, negative = extract_symbol_string_negativity(symbol)
                                  swt_constant_symbol = symbol_string.downcase == symbol_string ? symbol_string.upcase.to_sym : symbol_string.to_sym
                                  bit_value = constant_source_class.const_get(swt_constant_symbol)
                        Severity: Minor
                        Found in lib/glimmer/swt/style_constantizable.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

                        Class TableProxy has 35 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                            class TableProxy < Glimmer::SWT::WidgetProxy
                              include Glimmer
                              
                              module TableListenerEvent
                                def table_item
                        Severity: Minor
                        Found in lib/glimmer/swt/table_proxy.rb - About 4 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language