AndyObtiva/glimmer-dsl-tk

View on GitHub

Showing 65 of 117 total issues

Method launch has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
Open

  def launch
    @root = root {
      title 'Hello, Text!'
      width 1280
      height 800
Severity: Minor
Found in samples/hello/hello_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

File widget_proxy.rb has 598 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'yaml'
require 'glimmer/data_binding/tk/one_time_observer'
require 'glimmer/tk/widget'
require 'glimmer/tk/draggable_and_droppable'

Severity: Major
Found in lib/glimmer/tk/widget_proxy.rb - About 1 day to fix

    Class WidgetProxy has 52 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class WidgetProxy
          class << self
            def create(keyword, parent, args, &block)
              widget_proxy_class(keyword).new(keyword, parent, args, &block)
            end
    Severity: Major
    Found in lib/glimmer/tk/widget_proxy.rb - About 7 hrs to fix

      Method launch has 169 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def launch
          @root = root {
            title 'Hello, Text!'
            width 1280
            height 800
      Severity: Major
      Found in samples/hello/hello_text.rb - About 6 hrs to fix

        File text_proxy.rb has 368 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'glimmer/tk/widget_proxy'
        
        module Glimmer
          module Tk
            # Proxy for Tk::Text
        Severity: Minor
        Found in lib/glimmer/tk/text_proxy.rb - About 4 hrs to fix

          Class TextProxy has 34 methods (exceeds 20 allowed). Consider refactoring.
          Open

              class TextProxy < WidgetProxy
                ALL_TAG = '__all__'
                FORMAT_DEFAULT_MAP = {
                  'justify' => 'left',
                }
          Severity: Minor
          Found in lib/glimmer/tk/text_proxy.rb - About 4 hrs to fix

            Method handle_listener has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
            Open

                  def handle_listener(listener_name, &listener)
                    listener_name = listener_name.to_s
                    # TODO return a listener registration object that has a deregister method
                    if listener_name == 'destroy'
                      # 'destroy' is a more reliable alternative listener binding to '<Destroy>'
            Severity: Minor
            Found in lib/glimmer/tk/widget_proxy.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 make_draggable has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
            Open

                  def make_draggable
                    drag_event = nil
                    bind("<DropAcceptedEvent>", proc { |event| drag_event.drop_accepted = true })
                    bind("B1-Motion", proc { |tk_event|
                      if drag_event.nil?
            Severity: Minor
            Found in lib/glimmer/tk/draggable_and_droppable.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 grid has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

                  def grid(options = {})
                    @_visible = true
                    options = options.stringify_keys
                    options['rowspan'] = options.delete('row_span') if options.keys.include?('row_span')
                    options['columnspan'] = options.delete('column_span') if options.keys.include?('column_span')
            Severity: Minor
            Found in lib/glimmer/tk/widget_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

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

                class MenuItemProxy < WidgetProxy
                  ACCELERATOR_MODIFIER_EVENT_MAP = {
                    'Command' => 'Command',
                    'Cmd' => 'Command',
                    'Meta' => 'Command',
            Severity: Minor
            Found in lib/glimmer/tk/menu_item_proxy.rb - About 3 hrs to fix

              Class ToplevelProxy has 27 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class ToplevelProxy < WidgetProxy
                    REGEX_GEOMETRY = /[x+-]/
                    DEFAULT_WIDTH = 190
                    DEFAULT_HEIGHT = 0
                    
              Severity: Minor
              Found in lib/glimmer/tk/toplevel_proxy.rb - About 3 hrs to fix

                Method widget_custom_attribute_mapping has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def widget_custom_attribute_mapping
                        # TODO consider extracting to modules/subclasses
                        @widget_custom_attribute_mapping ||= {
                          ::Tk::Tile::TButton => {
                            'image' => {
                Severity: Major
                Found in lib/glimmer/tk/widget_proxy.rb - About 3 hrs to fix

                  Method widget_attribute_listener_installers has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def widget_attribute_listener_installers
                          # TODO consider extracting to modules/subclasses
                          @tk_widget_attribute_listener_installers ||= {
                            ::Tk::Tile::TCheckbutton => {
                              'variable' => lambda do |observer|
                  Severity: Major
                  Found in lib/glimmer/tk/widget_proxy.rb - About 3 hrs to fix

                    Method launch has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def launch
                        root {
                          title 'Hello, Label!'
                          
                          notebook {
                    Severity: Major
                    Found in samples/hello/hello_label.rb - About 2 hrs to fix

                      Method launch has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def launch
                          root {
                            title 'Hello, Theme!'
                            
                            labelframe {
                      Severity: Major
                      Found in samples/hello/hello_theme.rb - About 2 hrs to fix

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

                          def launch
                            @root = root {
                              title 'Glimmer Meta-Sample'
                              width 1280
                              height 720
                        Severity: Minor
                        Found in samples/elaborate/meta_sample.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 launch has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def launch
                            root {
                              text 'Hello, Progressbar!'
                              
                              progressbar {
                        Severity: Major
                        Found in samples/hello/hello_progressbar.rb - About 2 hrs to fix

                          Method launch has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def launch
                              @root = root {
                                title 'Glimmer Meta-Sample'
                                width 1280
                                height 720
                          Severity: Major
                          Found in samples/elaborate/meta_sample.rb - About 2 hrs to fix

                            File hello_text.rb has 263 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            require 'glimmer-dsl-tk'
                            
                            class HelloText
                              include Glimmer
                              
                            Severity: Minor
                            Found in samples/hello/hello_text.rb - About 2 hrs to fix

                              Method post_add_content has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                              Open

                                    def post_add_content
                                      if escapable?
                                         on('KeyPress') do |event|
                                          if event.state == 0 && event.keysym == 'Escape'
                                            tk.grab_release
                              Severity: Minor
                              Found in lib/glimmer/tk/toplevel_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

                              Severity
                              Category
                              Status
                              Source
                              Language