Showing 15 of 15 total issues

Class ArgumentBuilder has 37 methods (exceeds 20 allowed). Consider refactoring.
Open

    class ArgumentBuilder < BaseArgumentBuilder
      def method_argument_name
        name if has_input_value? && !helper_argument?
      end

Severity: Minor
Found in lib/gir_ffi/builders/argument_builder.rb - About 4 hrs to fix

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

      class Value
        setup_instance_method! :init
    
        METHOD_MAP = {
          TYPE_INVALID => [:get_none, :set_none],
    Severity: Minor
    Found in lib/ffi-gobject/value.rb - About 3 hrs to fix

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

          class UserDefinedBuilder < ObjectBuilder
            def initialize(info)
              @info = info
            end
      
      
      Severity: Minor
      Found in lib/gir_ffi/builders/user_defined_builder.rb - About 3 hrs to fix

        Class IObjectInfo has 24 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class IObjectInfo < IRegisteredTypeInfo
            def type_name
              Lib.g_object_info_get_type_name self
            end
        
        
        Severity: Minor
        Found in lib/ffi-gobject_introspection/i_object_info.rb - About 2 hrs to fix

          Class CallbackArgumentBuilder has 23 methods (exceeds 20 allowed). Consider refactoring.
          Open

              class CallbackArgumentBuilder < BaseArgumentBuilder
                def method_argument_name
                  @method_argument_name ||= name || new_variable
                end
          
          
          Severity: Minor
          Found in lib/gir_ffi/builders/callback_argument_builder.rb - About 2 hrs to fix

            Class ObjectBuilder has 21 methods (exceeds 20 allowed). Consider refactoring.
            Open

                class ObjectBuilder < RegisteredTypeBuilder
                  include WithLayout
            
                  # Dummy builder for the ObjectBase class
                  class ObjectBaseBuilder
            Severity: Minor
            Found in lib/gir_ffi/builders/object_builder.rb - About 2 hrs to fix

              Method modul has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                    def modul
                      unless defined? @module
                        build_dependencies
                        instantiate_module
                        setup_lib_for_ffi unless lib_already_set_up
              Severity: Minor
              Found in lib/gir_ffi/builders/module_builder.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

              Method marshaller has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def self.marshaller(closure, return_value, param_values, _invocation_hint,
                                      _marshal_data)
              Severity: Minor
              Found in lib/ffi-gobject/ruby_closure.rb - About 35 mins to fix

                Method signal_connect has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def self.signal_connect(object, detailed_signal, data = nil, after = false, &block)
                Severity: Minor
                Found in lib/ffi-gobject.rb - About 35 mins to fix

                  Method set_up_destroy_notifier_relations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def set_up_destroy_notifier_relations
                          @base_argument_builders.each do |bldr|
                            if (idx = bldr.destroy_idx) >= 0
                              target = @base_argument_builders[idx]
                              if target.specialized_type_tag == :callback &&
                  Severity: Minor
                  Found in lib/gir_ffi/builders/argument_builder_collection.rb - About 35 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 conversion has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def conversion
                          case @type_info.flattened_tag
                          when :utf8, :filename
                            if @ownership_transfer == :everything
                              "GirFFI::AllocationHelper.free_after #{@argument}, &:to_utf8"
                  Severity: Minor
                  Found in lib/gir_ffi/builders/c_to_ruby_convertor.rb - About 35 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 create_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.create_for path
                      stage = PhotoWall.new
                  
                      stage.instance_eval do
                        @path = path
                  Severity: Minor
                  Found in examples/clutter.rb - About 25 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 set_up_user_data_relations has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def set_up_user_data_relations
                          @base_argument_builders.each do |bldr|
                            if (idx = bldr.closure_idx) >= 0
                              target_bldr = @base_argument_builders[idx]
                              unless target_bldr.specialized_type_tag == :void
                  Severity: Minor
                  Found in lib/gir_ffi/builders/argument_builder_collection.rb - About 25 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

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

                  module GLib
                    # Overrides for GSList, GLib's singly-linked list implementation.
                    class SList
                      include ListMethods
                  
                  
                  Severity: Minor
                  Found in lib/ffi-glib/s_list.rb and 1 other location - About 25 mins to fix
                  lib/ffi-glib/list.rb on lines 7..24

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

                  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 GLib
                    # Overrides for GList, GLib's doubly linked list implementation.
                    class List
                      include ListMethods
                  
                  
                  Severity: Minor
                  Found in lib/ffi-glib/list.rb and 1 other location - About 25 mins to fix
                  lib/ffi-glib/s_list.rb on lines 7..24

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

                  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