AndyObtiva/glimmer-dsl-swt

View on GitHub

Showing 235 of 401 total issues

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

    Method initialize has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

          def initialize(keyword, *args, swt_dialog: nil)
            DisplayProxy.instance.auto_exec do
              dialog_class = self.class.dialog_class(keyword)
              if swt_dialog
                @swt_dialog = swt_dialog
    Severity: Minor
    Found in lib/glimmer/swt/dialog_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_shell_file has a Cognitive Complexity of 23 (exceeds 5 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: 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 setup_shape_painting has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

            def setup_shape_painting
              # TODO consider performance optimization relating to order of shape rendering (affecting only further shapes not previous ones)
              if @paint_listener_proxy.nil?
                shape_painter = lambda do |paint_event|
                  shape_painting_work = lambda do |paint_event|
    Severity: Minor
    Found in lib/glimmer/swt/custom/drawable.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 calculate_paint_args! has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

            def calculate_paint_args!
              unless @calculated_paint_args
                if @name == 'pixel'
                  @name = 'point'
                  # optimized performance calculation for pixel points
    Severity: Minor
    Found in lib/glimmer/swt/custom/shape.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 delegate_observation_request_to_radios has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

            def delegate_observation_request_to_radios(observation_request, &block)
              if observation_request != 'on_widget_disposed'
                radios.count.times do |index|
                  radio = radios[index]
                  label = labels[index]
    Severity: Minor
    Found in lib/glimmer/swt/custom/radio_group.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 apply_property_arg_conversions has 77 lines of code (exceeds 25 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: Major
    Found in lib/glimmer/swt/custom/shape.rb - About 3 hrs to fix

      Method calculate_args! has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def calculate_args!
                return @args if parent.is_a?(Drawable) && !default_x? && !default_y? && !default_width? && !default_height? && !max_width? && !max_height?
                calculated_args_dependencies = [
                  x,
                  y,
      Severity: Major
      Found in lib/glimmer/swt/custom/shape.rb - About 3 hrs to fix

        Method code_text_widget has 76 lines of code (exceeds 25 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: Major
        Found in lib/glimmer/swt/custom/code_text.rb - About 3 hrs to fix

          Class CodeText has 26 methods (exceeds 20 allowed). Consider refactoring.
          Open

                class CodeText
                  include Glimmer::UI::CustomWidget
                  
                  class << self
                    def languages
          Severity: Minor
          Found in lib/glimmer/swt/custom/code_text.rb - About 3 hrs to fix

            File custom_widget.rb has 289 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'glimmer'
            require 'glimmer/ui'
            require 'glimmer/error'
            require 'glimmer/swt/swt_proxy'
            require 'glimmer/swt/display_proxy'
            Severity: Minor
            Found in lib/glimmer/ui/custom_widget.rb - About 2 hrs to fix

              Method edit_tree_item has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
              Open

                    def edit_tree_item(tree_item, before_write: nil, after_write: nil, after_cancel: nil)
                      return if tree_item.nil?
                      content {
                        @tree_editor_text_proxy = text {
                          focus true
              Severity: Minor
              Found in lib/glimmer/swt/tree_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

              Method edit_table_item has 71 lines of code (exceeds 25 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: Major
              Found in lib/glimmer/swt/table_proxy.rb - About 2 hrs to fix

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

                        class Line < Shape
                          include PathSegment
                          
                          class << self
                            def include?(x1, y1, x2, y2, x, y)
                Severity: Minor
                Found in lib/glimmer/swt/custom/shape/line.rb - About 2 hrs to fix

                  Method same_table_data? has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def same_table_data?(new_model_collection)
                          (["text"] + TABLE_ITEM_PROPERTIES).all? do |table_item_property|
                            table_cells = @table.swt_widget.items.map do |item|
                              model = item.get_data
                              @table.column_properties.each_with_index.map do |column_property, i|
                  Severity: Minor
                  Found in lib/glimmer/data_binding/table_items_binding.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 print has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def print(gc=nil, job_name: nil)
                          if gc.is_a?(org.eclipse.swt.graphics.GC)
                            @swt_widget.print(gc)
                          else
                            image = Image.new(DisplayProxy.instance.swt_display, bounds)
                  Severity: Minor
                  Found in lib/glimmer/swt/widget_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 Path has 24 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                          class Path < Shape
                            include PathSegment # a path may behave as a path segment in another path
                            
                            attr_reader :swt_path, :path_segments
                            attr_accessor :calculated_path_args
                  Severity: Minor
                  Found in lib/glimmer/swt/custom/shape/path.rb - About 2 hrs to fix

                    Method custom_shell_gem has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            def custom_shell_gem(custom_shell_name, namespace)
                              gem_name = "glimmer-cs-#{compact_name(custom_shell_name)}"
                              gem_summary = "#{human_name(custom_shell_name)} - Glimmer Custom Shell"
                              begin
                                custom_shell_keyword = dsl_widget_name(custom_shell_name)
                    Severity: Major
                    Found in lib/glimmer/rake_task/scaffold.rb - About 2 hrs to fix

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

                              def apply_shape_arg_conversions!
                                if @args.size > 1 && (['polygon', 'polyline'].include?(@name))
                                  @args[0] = @args.dup
                                  @args[1..-1] = []
                                end
                      Severity: Minor
                      Found in lib/glimmer/swt/custom/shape.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 start has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                              def start
                                return if @start_number > 0 && started?
                                @start_number += 1
                                @start_time = Time.now
                                @duration = 0
                      Severity: Minor
                      Found in lib/glimmer/swt/custom/animation.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

                      Severity
                      Category
                      Status
                      Source
                      Language