AndyObtiva/glimmer-dsl-swt

View on GitHub

Showing 235 of 401 total issues

Class TableProxy has 37 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

    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 Game has 34 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class Game
          PLAYFIELD_WIDTH = 10
          PLAYFIELD_HEIGHT = 20
          PREVIEW_PLAYFIELD_WIDTH = 4
          PREVIEW_PLAYFIELD_HEIGHT = 2
    Severity: Minor
    Found in samples/elaborate/tetris/model/game.rb - About 4 hrs to fix

      Method update_table_item_properties_from_model has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

            def update_table_item_properties_from_model(table_item, row_index, column_index, model, model_attribute)
              Glimmer::SWT::DisplayProxy.instance.sync_exec do
                old_table_item_values = @last_model_collection_attribute_values &&
                  @last_model_collection_attribute_values[row_index] &&
                  model_attribute_values_for_index(@last_model_collection_attribute_values[row_index], column_index)
      Severity: Minor
      Found in lib/glimmer/data_binding/table_items_binding.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

      Method calculate_args! has a Cognitive Complexity of 28 (exceeds 5 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: Minor
      Found in lib/glimmer/swt/custom/shape.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

      File mandelbrot_fractal.rb has 333 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'glimmer-dsl-swt'
      require 'complex'
      require 'concurrent/executor/fixed_thread_pool'
      require 'concurrent/utility/processor_counter'
      require 'concurrent/array'
      Severity: Minor
      Found in samples/elaborate/mandelbrot_fractal.rb - About 4 hrs to fix

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

              def sort_by_column!(table_column_proxy=nil)
                index = nil
                auto_exec do
                  index = swt_widget.columns.to_a.index(table_column_proxy.swt_widget) unless table_column_proxy.nil?
                end
        Severity: Minor
        Found in lib/glimmer/swt/table_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 reset_logger! has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

              def reset_logger!
                if logger_type == :logger
                  reset_logger_without_glimmer_dsl_swt!
                else
                  require 'logging'
        Severity: Minor
        Found in lib/ext/glimmer/config.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 paint_pixel_by_pixel has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

                def paint_pixel_by_pixel(width = nil, height = nil, &each_pixel_color)
                  if @image_double_buffered
                    work = lambda do |paint_event|
                      width ||= swt_drawable.bounds.width
                      height ||= swt_drawable.bounds.height
        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 initialize has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

              def initialize(*args, &content)
                @args = args
                @parent_proxy = nil
                if @args.first.is_a?(WidgetProxy)
                  @parent_proxy = @args.shift
        Severity: Minor
        Found in lib/glimmer/swt/image_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 sort! has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

              def sort!(internal_sort: false)
                return unless sort_property && (sort_type || sort_block || sort_by_block)
                if sort_strategy
                  sort_strategy.call
                else
        Severity: Minor
        Found in lib/glimmer/swt/table_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 widget_custom_attribute_mapping has 92 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def widget_custom_attribute_mapping
                # TODO scope per widget class type just like other mappings
                @swt_widget_custom_attribute_mapping ||= {
                  'drag_source' => {
                    getter: {name: 'getShell', invoker: lambda { |widget, args|
        Severity: Major
        Found in lib/glimmer/swt/widget_proxy.rb - About 3 hrs to fix

          Class Animation has 30 methods (exceeds 20 allowed). Consider refactoring.
          Open

                class Animation
                  include Properties
                  include Glimmer::DataBinding::ObservableModel
                  
                  class << self
          Severity: Minor
          Found in lib/glimmer/swt/custom/animation.rb - About 3 hrs to fix

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

                  def enemy_attack!
                    begin
                      cell = nil
                      if @enemy_moves.any? && @enemy_moves.last.hit? && !@enemy_moves.last.ship.sunk?
                        if @enemy_moves[-2].nil? || !@enemy_moves[-2].hit?
            Severity: Minor
            Found in samples/elaborate/battleship/model/game.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 draw_frame has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

                    def draw_frame(start_number)
                      if stopped? or
                          (start_number != @start_number) or
                          (frame_count_limited? && @frame_index == @frame_count) or
                          (cycle_limited? && @cycle_count_index == @cycle_count) or
            Severity: Minor
            Found in lib/glimmer/swt/custom/animation.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 config has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                    def config
                      project_name = File.basename(File.expand_path('.'))
                      if !File.exists?('config/warble.rb')
                        puts 'Generating JAR configuration (config/warble.rb) to use with Warbler...'
                        FileUtils.mkdir_p('config')
            Severity: Minor
            Found in lib/glimmer/rake_task/package.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 paint_self has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                    def paint_self(paint_event)
                      @painting = true
                      unless container?
                        calculate_paint_args!
                        @original_gc_properties = {} # this stores GC properties before making calls to updates TODO avoid using in pixel graphics
            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

            File meta_sample.rb has 307 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require 'glimmer-dsl-swt'
            require 'fileutils'
            require 'yaml'
            require 'net/http'
            
            
            Severity: Minor
            Found in samples/elaborate/meta_sample.rb - About 3 hrs to fix

              File code_text.rb has 306 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'glimmer/ui/custom_widget'
              
              module Glimmer
                module SWT
                  module Custom
              Severity: Minor
              Found in lib/glimmer/swt/custom/code_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
                  Severity
                  Category
                  Status
                  Source
                  Language