rubinius/rubinius

View on GitHub
core/variable_scope.rb

Summary

Maintainability
B
6 hrs
Test Coverage

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

  class VariableScope
    # To handle Module#private, protected
    attr_accessor :method_visibility

    attr_reader :parent
Severity: Minor
Found in core/variable_scope.rb - About 2 hrs to fix

    Method local_variables has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def local_variables
          locals = []
          scope = self
    
          # Ascend up through all applicable blocks to get all vars.
    Severity: Minor
    Found in core/variable_scope.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 set_eval_local has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def set_eval_local(name, val)
          scope = @parent
          while scope
            if scope.dynamic_locals.key? name
              scope.dynamic_locals[name] = val
    Severity: Minor
    Found in core/variable_scope.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 eval_local_defined? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def eval_local_defined?(name, search=true)
          if search
            scope = self
            while scope
              return true if scope.dynamic_locals.key? name
    Severity: Minor
    Found in core/variable_scope.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 synthesize has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def self.synthesize(method, module_, parent, self_, block, locals)
    Severity: Minor
    Found in core/variable_scope.rb - About 45 mins to fix

      Avoid too many return statements within this method.
      Open

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

        There are no issues that match your filters.

        Category
        Status