rubinius/rubinius

View on GitHub
core/capi.rb

Summary

Maintainability
C
1 day
Test Coverage

Method rb_integer_pack has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def self.rb_integer_pack(value, words, numwords, wordsize, nails, flags)
      digits = INTEGER_PACK_DIGITS
      numbytes = numwords * wordsize
      nibble_size = numbytes * 2

Severity: Minor
Found in core/capi.rb - About 4 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 rb_integer_pack has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.rb_integer_pack(value, words, numwords, wordsize, nails, flags)
      digits = INTEGER_PACK_DIGITS
      numbytes = numwords * wordsize
      nibble_size = numbytes * 2

Severity: Major
Found in core/capi.rb - About 2 hrs to fix

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

        def self.rb_str_conv_enc_opts(str, from, to, flags, opts)
          return str if to.nil?
          return str if from == to
    
          if (to.ascii_compatible? and str.ascii_only?) or to == Encoding::ASCII_8BIT
    Severity: Minor
    Found in core/capi.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 rb_integer_pack has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def self.rb_integer_pack(value, words, numwords, wordsize, nails, flags)
    Severity: Minor
    Found in core/capi.rb - About 45 mins to fix

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

          def self.coerce(x, y, error=false)
            begin
              ary = y.coerce x
            rescue
              if error
      Severity: Minor
      Found in core/capi.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 rb_str_conv_enc_opts has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def self.rb_str_conv_enc_opts(str, from, to, flags, opts)
      Severity: Minor
      Found in core/capi.rb - About 35 mins to fix

        Avoid too many return statements within this method.
        Open

              return status == :finished ? result : str
        Severity: Major
        Found in core/capi.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return 1
          Severity: Major
          Found in core/capi.rb - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status