rubinius/rubinius

View on GitHub
core/library.rb

Summary

Maintainability
B
5 hrs
Test Coverage

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

      def ffi_lib(*names)
        @ffi_lib = names.map do |x|
          if x == FFI::CURRENT_PROCESS
            DynamicLibrary::CURRENT_PROCESS

Severity: Minor
Found in core/library.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 attach_variable has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def attach_variable(mname, a1, a2=nil)
        cname, type = a2 ? [ a1, a2 ] : [ mname.to_s, a1 ]
        ptr = nil

        ffi_libraries.each do |lib|
Severity: Minor
Found in core/library.rb - About 1 hr to fix

    Method attach_variable has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

          def attach_variable(mname, a1, a2=nil)
            cname, type = a2 ? [ a1, a2 ] : [ mname.to_s, a1 ]
            ptr = nil
    
            ffi_libraries.each do |lib|
    Severity: Minor
    Found in core/library.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 enum has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def enum(*args)
            @tagged_enums ||= Rubinius::LookupTable.new
            @anon_enums ||= Array.new
    
            tag, values = if args[0].kind_of?(Symbol) && args[1].kind_of?(Array)
    Severity: Minor
    Found in core/library.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 attach_function has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def attach_function(name, a2, a3, a4=nil, a5=nil)
    Severity: Minor
    Found in core/library.rb - About 35 mins to fix

      Method attach_function has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def attach_function(name, a2, a3, a4=nil, a5=nil)
              if a4 && (a2.kind_of?(String) || a2.kind_of?(Symbol))
                cname = a2.to_s
                args = a3
                ret = a4
      Severity: Minor
      Found in core/library.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

      There are no issues that match your filters.

      Category
      Status