rubinius/rubinius

View on GitHub
core/env.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Class EnvironmentVariables has 35 methods (exceeds 20 allowed). Consider refactoring.
Open

  class EnvironmentVariables
    include Enumerable

    def [](key)
      value = getenv(StringValue(key))
Severity: Minor
Found in core/env.rb - About 4 hrs to fix

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

        def each
          return to_enum(:each) { size } unless block_given?
    
          env = environ()
          ptr_size = FFI.type_size FFI.find_type(:pointer)
    Severity: Minor
    Found in core/env.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 reject! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def reject!
          return to_enum(:reject!) { size } unless block_given?
    
          # Avoid deleting from environ while iterating because the
          # OS can handle that in a million different bad ways.
    Severity: Minor
    Found in core/env.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 shift has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def shift
          env = environ()
    
          offset = 0
          cur = env + offset
    Severity: Minor
    Found in core/env.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