AndyObtiva/glimmer-dsl-swt

View on GitHub

Showing 401 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'
          
          # 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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                  class << self
                    def for(underscored_custom_widget_name)
                      unless flyweight_custom_widget_classes.keys.include?(underscored_custom_widget_name)
                        begin
                          extracted_namespaces = underscored_custom_widget_name.
            Severity: Major
            Found in lib/glimmer/ui/custom_widget.rb and 1 other location - About 1 day to fix
            lib/glimmer/ui/custom_shape.rb on lines 42..159

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 301.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                  class << self
                    def for(underscored_custom_shape_name)
                      unless flyweight_custom_shape_classes.keys.include?(underscored_custom_shape_name)
                        begin
                          extracted_namespaces = underscored_custom_shape_name.
            Severity: Major
            Found in lib/glimmer/ui/custom_shape.rb and 1 other location - About 1 day to fix
            lib/glimmer/ui/custom_widget.rb on lines 43..160

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 301.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            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
                        Severity
                        Category
                        Status
                        Source
                        Language