shoes/shoes4

View on GitHub

Showing 80 of 90 total issues

Class Dimensions has 60 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Dimensions
    include Common::Inspect

    attr_reader :parent, :x_dimension, :y_dimension
    protected :parent # we shall not mess with parent,see #495
Severity: Major
Found in shoes-core/lib/shoes/dimensions.rb - About 1 day to fix

    Class Slot has 47 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Slot < Common::UIElement
        include Common::Clickable
        include Common::Hover
    
        # We need that offset because otherwise element overlap e.g. occupy
    Severity: Minor
    Found in shoes-core/lib/shoes/slot.rb - About 6 hrs to fix

      Class App has 44 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class App
            include Common::Container
            include Common::Clickable
      
            attr_reader :dsl, :real, :shell, :click_listener
      Severity: Minor
      Found in shoes-swt/lib/shoes/swt/app.rb - About 6 hrs to fix

        Class Dimension has 40 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Dimension
            attr_reader :parent
            attr_accessor :absolute_start
            protected :parent # we shall not mess with parent,see #495
        
        
        Severity: Minor
        Found in shoes-core/lib/shoes/dimension.rb - About 5 hrs to fix

          Class InternalApp has 36 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class InternalApp
              include Common::Clickable
              include Common::Style
              include Common::SafelyEvaluate
              include DimensionsDelegations
          Severity: Minor
          Found in shoes-core/lib/shoes/internal_app.rb - About 4 hrs to fix

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

              def start_packaging
                pictures
                stack width: 600, margin_left: 200, margin_top: 170 do
                  @mac = package_check("Mac")
                  @windows = package_check("Windows")
            Severity: Minor
            Found in app/shoes_app.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 expert_tankspank.rb has 334 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            WIDTH = 700
            HEIGHT = 500
            CAMERA_TIGHTNESS = 0.1
            
            module Collisions
            Severity: Minor
            Found in samples/expert_tankspank.rb - About 4 hrs to fix

              Method initialize_backend has 86 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def self.initialize_backend
                    return if defined?(@initialized) && @initialized
                    @initialized = true
              
                    ::Shoes.configuration.backend = :swt
              Severity: Major
              Found in shoes-swt/lib/shoes/swt.rb - About 3 hrs to fix

                Class Field has 28 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Field
                  CELL_SIZE = 20
                  COLORS = %w[#00A #0A0 #A00 #004 #040 #400 #000].freeze
                
                  class Cell
                Severity: Minor
                Found in samples/expert_minesweeper.rb - About 3 hrs to fix

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

                    def draw_board
                      clear do
                        background black
                        draw_player_1
                        stack margin: 10 do
                  Severity: Minor
                  Found in samples/expert_othello.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 slot.rb has 295 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  class Shoes
                    class Slot < Common::UIElement
                      include Common::Clickable
                      include Common::Hover
                  
                  
                  Severity: Minor
                  Found in shoes-core/lib/shoes/slot.rb - About 3 hrs to fix

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

                      class Shape < Common::ArtElement
                        attr_reader :blk, :x, :y, :left_bound, :top_bound, :right_bound, :bottom_bound
                    
                        style_with :art_styles, :center, :common_styles, :dimensions
                        STYLES = { fill: Shoes::COLORS[:black] }.freeze
                    Severity: Minor
                    Found in shoes-core/lib/shoes/shape.rb - About 3 hrs to fix

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

                      class Shoes
                        module Swt
                          shoes_icon = ::Shoes::ICON
                          if shoes_icon.include? 'uri:classloader'
                            ICON = File.join(Dir.tmpdir, 'shoes-icon.png').freeze
                      Severity: Minor
                      Found in shoes-swt/lib/shoes/swt/app.rb - About 2 hrs to fix

                        Class TextSegmentCollection has 24 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                              class TextSegmentCollection
                                extend Forwardable
                                def_delegators :@segments, :length, :last, :inject,
                                               :one?, :any?, :empty?
                        
                        
                        Severity: Minor
                        Found in shoes-swt/lib/shoes/swt/text_block/text_segment_collection.rb - About 2 hrs to fix

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

                            def run(str)
                              obj = nil
                              @io << str
                              @io.rewind
                              l = lex
                          Severity: Minor
                          Found in samples/expert_irb.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

                          File dimensions.rb has 265 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          class Shoes
                            # Dimensions is a central class that most Shoes classes use to represent their
                            # dimensions, e.g. where they are and how much space they are taking up there.
                            # All the different position types might be confusing. So here is a little list:
                            #
                          Severity: Minor
                          Found in shoes-core/lib/shoes/dimensions.rb - About 2 hrs to fix

                            File expert_othello.rb has 264 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            module Othello
                              PIECE_WIDTH  = 62
                              PIECE_HEIGHT = 62
                              TOP_OFFSET   = 47
                              LEFT_OFFSET  = 12
                            Severity: Minor
                            Found in samples/expert_othello.rb - About 2 hrs to fix

                              Class Shoes has 22 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                              class Shoes
                                module Common
                                  module Style
                                    DEFAULT_STYLES = {
                                      rotate:      0,
                              Severity: Minor
                              Found in shoes-core/lib/shoes/common/style.rb - About 2 hrs to fix

                                Class Fitter has 21 methods (exceeds 20 allowed). Consider refactoring.
                                Open

                                      class Fitter
                                        attr_reader :parent
                                
                                        def initialize(text_block, current_position)
                                          @text_block = text_block
                                Severity: Minor
                                Found in shoes-swt/lib/shoes/swt/text_block/fitter.rb - About 2 hrs to fix

                                  Method data_path has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    def data_path
                                      user_data_directory = if RUBY_PLATFORM =~ /win32/
                                                              if ENV['USERPROFILE']
                                                                if File.join(File.expand_path(ENV['USERPROFILE']), "Application Data")
                                                                  File.join File.expand_path(ENV['USERPROFILE']), "Application Data", "GentleReminder"
                                  Severity: Minor
                                  Found in samples/expert_reminder.rb - About 1 hr 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