AndyObtiva/glimmer-dsl-libui

View on GitHub

Showing 312 of 312 total issues

File shape.rb has 267 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'glimmer/libui/parent'
require 'glimmer/libui/control_proxy/area_proxy'
require 'glimmer/libui/control_proxy/path_proxy'
require 'glimmer/libui/data_bindable'
require 'glimmer/libui/perfect_shaped'
Severity: Minor
Found in lib/glimmer/libui/shape.rb - About 2 hrs to fix

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

            def for(keyword)
              unless flyweight_custom_control_classes.keys.include?(keyword)
                begin
                  extracted_namespaces = keyword.
                    to_s.
    Severity: Minor
    Found in lib/glimmer/libui/custom_control.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 data_bind_read has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

            def data_bind_read(property, model_binding)
              if model_binding.binding_options[:column_attributes].is_a?(Array)
                @column_attributes = model_binding.binding_options[:column_attributes]
              else
                column_attribute_mapping = model_binding.binding_options[:column_attributes].is_a?(Hash) ? model_binding.binding_options[:column_attributes] : {}
    Severity: Minor
    Found in lib/glimmer/libui/control_proxy/table_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

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

            def for(keyword)
              unless flyweight_custom_shape_classes.keys.include?(keyword)
                begin
                  extracted_namespaces = keyword.
                    to_s.
    Severity: Minor
    Found in lib/glimmer/libui/custom_shape.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 basic_table_selection2.rb has 260 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'glimmer-dsl-libui'
    
    class BasicTableSelection
      TableColumnPresenter = Struct.new(:name,
                                        :column,
    Severity: Minor
    Found in examples/basic_table_selection2.rb - About 2 hrs to fix

      File basic_table_selection.rb has 260 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'glimmer-dsl-libui'
      
      class BasicTableSelection
        TableColumnPresenter = Struct.new(:name,
                                          :column,
      Severity: Minor
      Found in examples/basic_table_selection.rb - About 2 hrs to fix

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

          def launch
            window('Login') {
              margined true
              
              vertical_box {
        Severity: Major
        Found in examples/login4.rb and 1 other location - About 2 hrs to fix
        examples/login3.rb on lines 22..56

        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 83.

        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

          def launch
            window('Login') {
              margined true
              
              vertical_box {
        Severity: Major
        Found in examples/login3.rb and 1 other location - About 2 hrs to fix
        examples/login4.rb on lines 18..52

        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 83.

        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 last_cell_row_for has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

                def last_cell_row_for(row)
                  # TODO refactor to share code with cell_row_for
                  @cached_last_cell_rows ||= []
                  if @cached_last_cell_rows[row].nil?
                    last_cell_rows = @last_cell_rows || []
        Severity: Minor
        Found in lib/glimmer/libui/control_proxy/table_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

        Method last_last_cell_row_for has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

                def last_last_cell_row_for(row)
                  # TODO refactor to share code with cell_row_for
                  @cached_last_last_cell_rows ||= []
                  if @cached_last_last_cell_rows[row].nil?
                    last_last_cell_rows = @last_last_cell_rows || []
        Severity: Minor
        Found in lib/glimmer/libui/control_proxy/table_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

        Method custom_window_gem has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

                def custom_window_gem(custom_window_name, namespace)
                  gem_name = "glimmer-libui-cw-#{custom_window_name.underscore}"
                  gem_summary = "#{human_name(custom_window_name)} - Glimmer Custom Window"
                  begin
                    custom_window_keyword = dsl_control_name(custom_window_name)
        Severity: Minor
        Found in lib/glimmer/rake_task/scaffold.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 cell_row_for has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

                def cell_row_for(row)
                  @cached_cell_rows ||= []
                  if @cached_cell_rows[row].nil?
                    cell_rows = self.cell_rows || []
                    if cell_rows.is_a?(Enumerator)
        Severity: Minor
        Found in lib/glimmer/libui/control_proxy/table_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

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

                def handle_listener(listener_name, &listener)
                  # if content has been added, then you can register listeners immediately (without accumulation)
                  if CUSTOM_LISTENER_NAMES.include?(listener_name) || @content_added
                    actual_listener = listener
                    case listener_name
        Severity: Minor
        Found in lib/glimmer/libui/control_proxy/table_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

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

        module Glimmer
          module DSL
            module Libui
              class CustomControlExpression < Expression
                # TODO Consider making custom controls automatically generate static expressions
        Severity: Major
        Found in lib/glimmer/dsl/libui/custom_control_expression.rb and 1 other location - About 2 hrs to fix
        lib/glimmer/dsl/libui/custom_shape_expression.rb on lines 28..54

        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 80.

        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

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

        module Glimmer
          module DSL
            module Libui
              class CustomShapeExpression < Expression
                # TODO Consider making custom shapes automatically generate static expressions
        Severity: Major
        Found in lib/glimmer/dsl/libui/custom_shape_expression.rb and 1 other location - About 2 hrs to fix
        lib/glimmer/dsl/libui/custom_control_expression.rb on lines 29..55

        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 80.

        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

            figure { # declarative stable path with explicit attributes (implicit path syntax for a single shape nested directly under area)
              x 0
              y 0
              
              bezier {
        Severity: Major
        Found in examples/area_gallery2.rb and 1 other location - About 2 hrs to fix
        examples/area_gallery4.rb on lines 67..100

        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 80.

        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

              figure { # dynamic path, added semi-declaratively inside on_draw block
                x 0
                y 0
                
                bezier {
        Severity: Major
        Found in examples/area_gallery4.rb and 1 other location - About 2 hrs to fix
        examples/area_gallery2.rb on lines 66..99

        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 80.

        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 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

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

                  @area = area {
                    on_draw do |area_draw_params|
                      rectangle(0, 0, area_draw_params[:area_width], area_draw_params[:area_height]) {
                        fill 0xFFFFFF
                      }
          Severity: Major
          Found in examples/histogram.rb and 1 other location - About 2 hrs to fix
          examples/histogram2.rb on lines 82..104

          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 79.

          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

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

              @area = area {
                on_draw do |area_draw_params|
                  rectangle(0, 0, area_draw_params[:area_width], area_draw_params[:area_height]) {
                    fill 0xFFFFFF
                  }
          Severity: Major
          Found in examples/histogram2.rb and 1 other location - About 2 hrs to fix
          examples/histogram.rb on lines 78..100

          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 79.

          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

          Severity
          Category
          Status
          Source
          Language