AndyObtiva/glimmer-dsl-libui

View on GitHub

Showing 156 of 312 total issues

Method create_gui has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create_gui
    @main_window = window('Tic-Tac-Toe', 180, 180) {
      resizable false
      
      @cells = []
Severity: Minor
Found in examples/tic_tac_toe2.rb - About 1 hr to fix

    Method create_gui has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def create_gui
        menu('Help') {
          menu_item('Version') {
            on_clicked do
              show_version
    Severity: Minor
    Found in examples/midi_player.rb - About 1 hr to fix

      Method create_gui has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def create_gui
          menu('Help') {
            menu_item('Version') {
              on_clicked do
                show_version
      Severity: Minor
      Found in examples/midi_player2.rb - About 1 hr to fix

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

              def rotate!(direction)
                return if stopped?
                can_rotate = nil
                new_blocks = nil
                game.hypothetical do
        Severity: Minor
        Found in examples/tetris/model/tetromino.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 timer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

              def timer(time_in_seconds = 0.1, repeat: true, &block)
                closure = fiddle_closure_block_caller(4, [0]) do
                  result = boolean_to_integer(block.call, allow_integer: false)
                  repeat -= 1 if repeat.is_a?(Integer)
                  if result.nil?
        Severity: Minor
        Found in lib/glimmer/libui.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 create_gui has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          def create_gui
            @main_window = window('Tic-Tac-Toe', 180, 180) {
              resizable false
              
              @cells = []
        Severity: Minor
        Found in examples/tic_tac_toe2.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 common_app has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

                def common_app(app_name, window_type = :app, window_options = {})
                  gem_name = file_name(app_name)
                  gem_summary = human_name(app_name)
                  return puts("The directory '#{gem_name}' already exists. Please either remove or pick a different name.") if Dir.exist?(gem_name)
        #           system "ruby -S gem install bundler --no-document" if OS.windows? # resolves freezing issue with warbler and bundler 2.2.29 included in JRuby
        Severity: Minor
        Found in lib/glimmer/rake_task/scaffold.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 create_gui has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          def create_gui
            @main_window = window('Tic-Tac-Toe', 180, 180) {
              resizable false
              
              vertical_box {
        Severity: Minor
        Found in examples/tic_tac_toe.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 build_control has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

                def build_control
                  if OS.mac? && ControlProxy.menu_proxies.empty?
                    menu_proxy = ControlProxy.create('menu', nil, [''])
                    quit_menu_item_proxy = ControlProxy.create('quit_menu_item', menu_proxy, [])
                  end
        Severity: Minor
        Found in lib/glimmer/libui/control_proxy/window_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 perfect_shape has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

                def perfect_shape
                  require 'perfect-shape'
                  the_perfect_shape_dependencies = perfect_shape_dependencies
                  if the_perfect_shape_dependencies != @perfect_shape_dependencies
                    absolute_x_center, absolute_y_center, radius, start_angle, sweep, is_negative = @perfect_shape_dependencies = the_perfect_shape_dependencies
        Severity: Minor
        Found in lib/glimmer/libui/shape/arc.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 create_gui has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def create_gui
            @main_window = window('Tic-Tac-Toe', 180, 180) {
              resizable false
              
              vertical_box {
        Severity: Minor
        Found in examples/tic_tac_toe.rb - About 1 hr to fix

          Method handle_listener has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def handle_listener(listener_name, &listener)
                    case listener_name
                    when 'on_closing'
                      @on_closing_listeners ||= []
                      @on_closing_listeners << listener
          Severity: Minor
          Found in lib/glimmer/libui/control_proxy/window_proxy.rb - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                      if draw_brush.Type == 0
                        draw_brush.R = (draw_brush_args[:r] || draw_brush_args[:red]).to_f / 255.0
                        draw_brush.G = (draw_brush_args[:g] || draw_brush_args[:green]).to_f / 255.0
                        draw_brush.B = (draw_brush_args[:b] || draw_brush_args[:blue]).to_f / 255.0
                        draw_brush.A = (draw_brush_args[:a] || draw_brush_args[:alpha] || 1.0)
            Severity: Major
            Found in lib/glimmer/libui/control_proxy/path_proxy.rb - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                          if !new_value.is_a?(Enumerator) &&
                            (
                              model_binding.binding_options[:column_attributes] ||
                              (!new_value.nil? && (!new_value.is_a?(String) || !new_value.empty?) && (!new_value.is_a?(Array) || !new_value.first.is_a?(Array)))
                            )
              Severity: Major
              Found in lib/glimmer/libui/control_proxy/table_proxy.rb - About 1 hr to fix

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

                  def text_label(label_text,
                                  width: 80, height: 30, font_descriptor: {},
                                  background_fill: {a: 0}, text_color: :black, border_stroke: {a: 0},
                                  text_x: nil, text_y: nil,
                                  &content)
                Severity: Minor
                Found in examples/area_based_custom_controls.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 colorable has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  def colorable(shape_symbol, *args, &content)
                    send(shape_symbol, *args) do |shape|
                      on_mouse_up do |area_mouse_event|
                        unless @dragged_shape
                          old_stroke = Glimmer::LibUI.interpret_color(shape.stroke).slice(:r, :g, :b)
                Severity: Minor
                Found in examples/shape_coloring.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 add_content has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                        def add_content(custom_control, keyword, *args, &block)
                          options = args.last.is_a?(Hash) ? args.last : {}
                          options[:post_add_content] = true if !options.include?(:post_add_content)
                          # TODO consider avoiding source_location
                          if block.source_location == custom_control.content&.__getobj__&.source_location
                Severity: Minor
                Found in lib/glimmer/dsl/libui/custom_control_expression.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 draw_fill_mode has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                        def draw_fill_mode
                          @args[0].is_a?(Integer) ? (@args[0] == 0 ? :winding : :alternate ) : ((@args[0].is_a?(String) || @args[0].is_a?(Symbol)) ? @args[0].to_sym : :winding)
                        end
                Severity: Minor
                Found in lib/glimmer/libui/control_proxy/path_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 width has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                        def width(value = nil)
                          if value.nil?
                            @args.size > 3 ? @args[3] : (@options[:width] || @args[1])
                          else
                            set_width_variable(value)
                Severity: Minor
                Found in lib/glimmer/libui/control_proxy/image_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 height has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                        def height(value = nil)
                          if value.nil?
                            @args.size > 3 ? @args[4] : (@options[:height] || @args[2])
                          else
                            set_height_variable(value)
                Severity: Minor
                Found in lib/glimmer/libui/control_proxy/image_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

                Severity
                Category
                Status
                Source
                Language