AndyObtiva/glimmer-dsl-libui

View on GitHub

Showing 312 of 312 total issues

Method draw has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def draw(area_draw_params)
        @start = ::LibUI.attributed_string_len(@parent_proxy.attributed_string)
        ::LibUI.attributed_string_append_unattributed(@parent_proxy.attributed_string, @string)
        unless color.nil?
          color_attribute = ::LibUI.new_color_attribute(@color[:r].to_f / 255.0, @color[:g].to_f / 255.0, @color[:b].to_f / 255.0, @color[:a] || 1.0)
Severity: Major
Found in lib/glimmer/libui/attributed_string.rb - About 2 hrs to fix

    Method table_paginator has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def table_paginator
              horizontal_box {
                stretchy false
                
                button('<<') {
    Severity: Major
    Found in lib/glimmer/libui/custom_control/refined_table.rb - About 2 hrs to fix

      Method register_cell_rows_observer has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def register_cell_rows_observer
                # TODO update all the each_with_index calls below to work differently when value is an Enumerator
                # Perhaps, call ::LibUI.table_model_row_inserted(model, row) not from here, yet from the place where
                # we call `next` on the Enumerator to grab more elements
                # There will need to be extra intelligence for figuring out when to delete instead of
      Severity: Minor
      Found in lib/glimmer/libui/control_proxy/table_proxy.rb - About 2 hrs to fix

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

          def launch
            window('Dynamic Area', 240, 600) {
              margined true
              
              vertical_box {
        Severity: Minor
        Found in examples/dynamic_area.rb - About 2 hrs to fix

          Method common_app has 50 lines of code (exceeds 25 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 2 hrs to fix

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

              def create_gui
                window('Timer') {
                  margined true
                  
                  group('Countdown') {
            Severity: Minor
            Found in examples/timer2.rb - About 1 hr to fix

              Method calculate_shapes has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                      def calculate_shapes
                        @shapes = []
                        original_pixels = @pixels.dup
                        indexed_original_pixels = Hash[original_pixels.each_with_index.to_a]
                        x_offset = x
              Severity: Minor
              Found in lib/glimmer/libui/control_proxy/image_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 build_control has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                      def build_control
                        unless area_image? # image object
                          if file
                            load_image
                            ImagePartProxy.new('image_part', self, [@data, width, height, width * 4])
              Severity: Minor
              Found in lib/glimmer/libui/control_proxy/image_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 a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                    def launch(application, ruby_options: [], env_vars: {}, glimmer_options: {})
                      ruby_options_string = ruby_options.join(' ') + ' ' if ruby_options.any?
                      env_vars = env_vars.merge(glimmer_option_env_vars(glimmer_options))
                      load_env_vars(env_vars)
                      the_glimmer_lib = glimmer_lib
              Severity: Minor
              Found in lib/glimmer/launcher.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 draw has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                      def draw(area_draw_params)
                        children.each do |child|
                          child_fill = child.fill
                          child_stroke = child.stroke
                          child_transform = child.transform
              Severity: Minor
              Found in lib/glimmer/libui/shape/composite_shape.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 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def create_gui
                  window('Timer') {
                    margined true
                    
                    group('Countdown') {
              Severity: Minor
              Found in examples/timer.rb - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                              if ((
                                    handle_custom_listener('on_key_event').empty? ||
                                    (handle_custom_listener('on_key_event').any? && on_key_event_results.all? {|result| LibUI.boolean_to_integer(result) == 0})
                                  ) &&
                                  (
                Severity: Critical
                Found in lib/glimmer/libui/control_proxy/area_proxy.rb - About 1 hr to fix

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                      arc { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
                        x_center 404
                        y_center 216
                        radius 190
                        start_angle 90
                  Severity: Major
                  Found in examples/area_gallery2.rb and 1 other location - About 1 hr to fix
                  examples/area_gallery4.rb on lines 129..139

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 67.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                        arc { # dynamic path, added semi-declaratively inside on_draw block
                          x_center 404
                          y_center 216
                          radius 190
                          start_angle 90
                  Severity: Major
                  Found in examples/area_gallery4.rb and 1 other location - About 1 hr to fix
                  examples/area_gallery2.rb on lines 128..138

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 67.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                        number = index + 1
                        first_name = NAMES_FIRST.sample
                        last_name = NAMES_LAST.sample
                        phone = 10.times.map { rand(10) }.yield_self { |numbers| [numbers[0..2], numbers[3..5], numbers[6..9]].map(&:join).join('-') }
                        city = CITIES.sample
                  Severity: Major
                  Found in examples/lazy_table4.rb and 1 other location - About 1 hr to fix
                  examples/lazy_table2.rb on lines 38..47

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 66.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                          number = index + 1
                          first_name = NAMES_FIRST.sample
                          last_name = NAMES_LAST.sample
                          phone = 10.times.map { rand(10) }.yield_self { |numbers| [numbers[0..2], numbers[3..5], numbers[6..9]].map(&:join).join('-') }
                          city = CITIES.sample
                  Severity: Major
                  Found in examples/lazy_table2.rb and 1 other location - About 1 hr to fix
                  examples/lazy_table4.rb on lines 37..46

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 66.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

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

                    def launch
                      window('Contacts', 600, 600) {
                        margined true
                        
                        vertical_box {
                  Severity: Minor
                  Found in examples/form_table.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 a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def launch
                      window('Contacts', 600, 600) {
                        margined true
                        
                        vertical_box {
                  Severity: Minor
                  Found in examples/form_table4.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 a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def launch
                      window('Contacts', 600, 600) {
                        margined true
                        
                        vertical_box {
                  Severity: Minor
                  Found in examples/form_table3.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 a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def launch
                      window('Contacts', 600, 600) {
                        margined true
                        
                        vertical_box {
                  Severity: Minor
                  Found in examples/form_table2.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