AndyObtiva/glimmer-dsl-libui

View on GitHub

Showing 312 of 312 total issues

File control_proxy.rb has 342 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'glimmer/libui/data_bindable'

module Glimmer
  module LibUI
    # Proxy for LibUI control objects
Severity: Minor
Found in lib/glimmer/libui/control_proxy.rb - About 4 hrs to fix

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

            def custom_control_gem(custom_control_name, namespace)
              gem_name = "glimmer-libui-cc-#{custom_control_name.underscore}"
              gem_summary = "#{human_name(custom_control_name)} - Glimmer Custom Control"
              if namespace
                gem_name += "-#{namespace.underscore}"
    Severity: Major
    Found in lib/glimmer/rake_task/scaffold.rb and 1 other location - About 4 hrs to fix
    lib/glimmer/rake_task/scaffold.rb on lines 333..369

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

    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

            def custom_shape_gem(custom_shape_name, namespace)
              gem_name = "glimmer-libui-cs-#{custom_shape_name.underscore}"
              gem_summary = "#{human_name(custom_shape_name)} - Glimmer Custom Shape"
              if namespace
                gem_name += "-#{namespace.underscore}"
    Severity: Major
    Found in lib/glimmer/rake_task/scaffold.rb and 1 other location - About 4 hrs to fix
    lib/glimmer/rake_task/scaffold.rb on lines 294..330

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

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

      def launch
        window('Michael Ende (1929-1995) The Neverending Story', 600, 500) {
          margined true
          
          vertical_box {
    Severity: Major
    Found in examples/custom_draw_text2.rb - About 3 hrs to fix

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

        def launch
          window('Meta-Example', 1000, 500) {
            margined true
            
            horizontal_box {
      Severity: Major
      Found in examples/meta_example.rb - About 3 hrs to fix

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

          def launch
            menu('Actions') {
              menu_item('Restart') {
                on_clicked do
                  restart_game
        Severity: Major
        Found in examples/color_the_circles.rb - About 3 hrs to fix

          Method draw has a Cognitive Complexity of 26 (exceeds 5 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: Minor
          Found in lib/glimmer/libui/attributed_string.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

          Method send_to_libui has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

                def send_to_libui(method_name, *args, &block)
                  if ::LibUI.respond_to?("#{libui_api_keyword}_#{method_name.to_s.sub(/\?$/, '')}") && args.empty?
                    property = method_name.to_s.sub(/\?$/, '')
                    value = ::LibUI.send("#{libui_api_keyword}_#{property}", libui, *args)
                    handle_string_property(property, handle_boolean_property(property, value))
          Severity: Minor
          Found in lib/glimmer/libui/control_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

          Method custom_window_file has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

                  def custom_window_file(custom_window_name, namespace, window_type, window_options = {})
                    window_options ||= {}
                    window_options[:custom_window_class_name] ||= 'CustomWindow'
                    namespace_type = class_name(namespace) == class_name(current_dir_name) ? 'class' : 'module'
              
          Severity: Minor
          Found in lib/glimmer/rake_task/scaffold.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

          Method interpret_color has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

                def interpret_color(value)
                  if value.is_a?(Array) && value.last.is_a?(Hash)
                    options = value.last
                    value = value[0...-1]
                  end
          Severity: Minor
          Found in lib/glimmer/libui.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

          Method boolean_to_integer has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

                def boolean_to_integer(bool, allow_nil: true, allow_integer: true)
                  bool.nil? ? (allow_nil ? nil : 0) : (allow_integer && bool.is_a?(Integer) ? bool : (bool.is_a?(TrueClass) || bool.is_a?(FalseClass) ? (bool == true ? 1 : 0) : (allow_nil ? nil : 0)))
                end
          Severity: Minor
          Found in lib/glimmer/libui.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

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

                  def for(keyword)
                    unless flyweight_custom_control_classes.keys.include?(keyword)
                      begin
                        extracted_namespaces = keyword.
                          to_s.
          Severity: Major
          Found in lib/glimmer/libui/custom_control.rb and 1 other location - About 3 hrs to fix
          lib/glimmer/libui/custom_shape.rb on lines 65..95

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

          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

                  tab_item('One') {
                    vertical_box {
                      vertical_box {
                        stretchy false
                        
          Severity: Major
          Found in examples/basic_table_selection2.rb and 1 other location - About 3 hrs to fix
          examples/basic_table_selection2.rb on lines 150..200

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

          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

                  tab_item('Zero-Or-One') {
                    vertical_box {
                      vertical_box {
                        stretchy false
                        
          Severity: Major
          Found in examples/basic_table_selection2.rb and 1 other location - About 3 hrs to fix
          examples/basic_table_selection2.rb on lines 94..144

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

          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

                  def for(keyword)
                    unless flyweight_custom_shape_classes.keys.include?(keyword)
                      begin
                        extracted_namespaces = keyword.
                          to_s.
          Severity: Major
          Found in lib/glimmer/libui/custom_shape.rb and 1 other location - About 3 hrs to fix
          lib/glimmer/libui/custom_control.rb on lines 67..97

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

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

            def launch
              window('Michael Ende (1929-1995) The Neverending Story', 600, 500) {
                margined true
                
                vertical_box {
          Severity: Major
          Found in examples/custom_draw_text.rb - About 3 hrs to fix

            Class Scaffold has 28 methods (exceeds 20 allowed). Consider refactoring.
            Open

                class Scaffold
                  class << self
                    include FileUtils
                
                    VERSION = File.read(File.expand_path('../../../../VERSION', __FILE__)).strip
            Severity: Minor
            Found in lib/glimmer/rake_task/scaffold.rb - About 3 hrs to fix

              Class Tetromino has 28 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class Tetromino
                    ORIENTATIONS = [:north, :east, :south, :west]
                    
                    LETTER_COLORS = {
                      I: :cyan,
              Severity: Minor
              Found in examples/tetris/model/tetromino.rb - About 3 hrs to fix

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

                  def launch
                    window('Contacts', 600, 600) {
                      margined true
                      
                      vertical_box {
                Severity: Major
                Found in examples/form_table3.rb - About 3 hrs to fix

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

                    def launch
                      window('Contacts', 600, 600) {
                        margined true
                        
                        vertical_box {
                  Severity: Major
                  Found in examples/form_table2.rb - About 3 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language