AndyObtiva/glimmer-dsl-tk

View on GitHub

Showing 65 of 117 total issues

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

  def launch
    root {
      title 'Hello, Frame!'
      
      frame { # frame simply contains widgets for visual organization via a layout
Severity: Minor
Found in samples/hello/hello_frame.rb - About 1 hr to fix

    Method post_add_content has 32 lines of code (exceeds 25 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 1 hr to fix

      Method initialize has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def initialize
            reset_activities!
            individual_observer = Glimmer::DataBinding::Observer.proc do
              unless @updating_group
                @updating_individual = true
      Severity: Minor
      Found in samples/hello/hello_checkbutton.rb - About 1 hr to fix

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

              def handle_listener(listener_name, &listener)
                case listener_name.to_s.downcase
                when '<<modified>>', '<modified>', 'modified'
                  modified_listener = Proc.new do |*args|
                    @modified_count ||= 0
        Severity: Minor
        Found in lib/glimmer/tk/text_proxy.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

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

          def launch
            root {
              title 'Hello, Spinbox!'
              
              label {
        Severity: Minor
        Found in samples/hello/hello_spinbox.rb - About 1 hr to fix

          Method handle_listener has 29 lines of code (exceeds 25 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 1 hr to fix

            Method show_find_dialog has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              def show_find_dialog
                toplevel(@root) { |tl|
                  title 'Find'
                  
                  label {
            Severity: Minor
            Found in samples/hello/hello_text.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

            Method font= has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

                  def font=(value)
                    if (value.is_a?(Symbol) || value.is_a?(String)) && FONTS_PREDEFINED.include?(value.to_s.downcase)
                      @tk.font = "tk_#{value}_font".camelcase(:upper)
                    else
                      @tk.font = value.is_a?(TkFont) ? value : TkFont.new(value)
            Severity: Minor
            Found in lib/glimmer/tk/widget_proxy.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

            Method set_attribute has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def set_attribute(attribute, *args)
                    case attribute.to_s
                    when 'yscrollbar'
                      @yscrollbar = args.first
                      if @yscrollbar == true
            Severity: Minor
            Found in lib/glimmer/tk/scrollbar_frame_proxy.rb - About 1 hr to fix

              Method grid has 26 lines of code (exceeds 25 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 1 hr to fix

                Method attribute_argument_normalizers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                      def attribute_argument_normalizers
                        color_normalizer = lambda do |args|
                          if args.size > 1 || args.first.is_a?(Numeric)
                            rgb = args
                            rgb = rgb.map(&:to_s).map(&:to_i)
                Severity: Minor
                Found in lib/glimmer/tk/widget_proxy.rb - About 55 mins 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 method_missing has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                      def method_missing(method, *args, &block)
                        method = method.to_s
                        attribute_name = method.sub(/=$/, '')
                        args = normalize_attribute_arguments(attribute_name, args)
                        if args.empty? && block.nil? && ((widget_custom_attribute_mapping[tk.class] && widget_custom_attribute_mapping[tk.class][method]) || has_state?(method) || has_attributes_attribute?(method))
                Severity: Minor
                Found in lib/glimmer/tk/widget_proxy.rb - About 55 mins 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 get_attribute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                      def get_attribute(attribute)
                        widget_custom_attribute = widget_custom_attribute_mapping[tk.class] && widget_custom_attribute_mapping[tk.class][attribute.to_s]
                        if respond_to?(attribute, super_only: true)
                          send(attribute)
                        elsif widget_custom_attribute
                Severity: Minor
                Found in lib/glimmer/tk/widget_proxy.rb - About 55 mins 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 applied_font_format_tags_and_regions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                      def applied_font_format_tags_and_regions(region_start, region_end)
                        lines = value.split("\n")
                        tags_and_regions = []
                        all_tag_names = (@tk.tag_names - ['sel', ALL_TAG]).select {|tag_name| tag_name.include?('_font_')}
                        (region_start.to_i..region_end.to_i).each do |line_number|
                Severity: Minor
                Found in lib/glimmer/tk/text_proxy.rb - About 55 mins 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 post_add_content has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                      def post_add_content
                        case @parent_proxy
                        when ToplevelProxy
                          if @keyword == 'menu_bar'
                            @parent_proxy.tk['menu'] = @tk
                Severity: Minor
                Found in lib/glimmer/tk/menu_proxy.rb - About 55 mins 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 applied_format_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                      def applied_format_value(text_index = nil, option)
                        text_index ||= @tk.index('insert')
                        region_start = text_index
                        region_end = text_index
                        tag_names = @tk.tag_names - ['sel', ALL_TAG]
                Severity: Minor
                Found in lib/glimmer/tk/text_proxy.rb - About 45 mins 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

                Avoid deeply nested control flow statements.
                Open

                            self.value = variable.value = attribute_value_hash.values.first if variable.value == @last_label
                Severity: Major
                Found in lib/glimmer/tk/menu_item_proxy.rb - About 45 mins to fix

                  Consider simplifying this complex logical expression.
                  Open

                            elsif args.size == 1 &&
                                  args.first.is_a?(String) &&
                                  !args.first.start_with?('#') &&
                                  (args.first.size == 3 || args.first.size == 6)  &&
                                  (args.first.chars.all? {|char| HEXADECIMAL_CHARACTERS.include?(char.downcase)})
                  Severity: Major
                  Found in lib/glimmer/tk/widget_proxy.rb - About 40 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                            elsif method.end_with?('=') && block.nil? && ((widget_custom_attribute_mapping[tk.class] && widget_custom_attribute_mapping[tk.class][method.sub(/=$/, '')]) || has_state?(method) || has_attributes_attribute?(method))
                              set_attribute(attribute_name, *args)
                            else
                              tk.send(method, *args, &block)
                    Severity: Major
                    Found in lib/glimmer/tk/widget_proxy.rb - About 40 mins to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if args.empty? && block.nil? && ((widget_custom_attribute_mapping[tk.class] && widget_custom_attribute_mapping[tk.class][method]) || has_state?(method) || has_attributes_attribute?(method))
                                get_attribute(method)
                              elsif method.end_with?('=') && block.nil? && ((widget_custom_attribute_mapping[tk.class] && widget_custom_attribute_mapping[tk.class][method.sub(/=$/, '')]) || has_state?(method) || has_attributes_attribute?(method))
                                set_attribute(attribute_name, *args)
                              else
                      Severity: Major
                      Found in lib/glimmer/tk/widget_proxy.rb - About 40 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language