class Solargraph::TypeChecker::Rules

Definitions of type checking rules to be performed at various levels

Constants

LEVELS

Attributes

level[R]

@return [Symbol]

rank[R]

@return [Integer]

Public Class Methods

new(level) click to toggle source

@param level [Symbol]

# File lib/solargraph/type_checker/rules.rb, line 22
def initialize level
  @rank = if LEVELS.key?(level)
    LEVELS[level]
  else
    Solargraph.logger.warn "Unrecognized TypeChecker level #{level}, assuming normal"
    0
  end
  @level = LEVELS[LEVELS.values.index(@rank)]
end

Public Instance Methods

ignore_all_undefined?() click to toggle source
# File lib/solargraph/type_checker/rules.rb, line 32
def ignore_all_undefined?
  rank < LEVELS[:strict]
end
must_tag_or_infer?() click to toggle source
# File lib/solargraph/type_checker/rules.rb, line 48
def must_tag_or_infer?
  rank > LEVELS[:typed]
end
require_type_tags?() click to toggle source
# File lib/solargraph/type_checker/rules.rb, line 44
def require_type_tags?
  rank >= LEVELS[:strong]
end
validate_calls?() click to toggle source
# File lib/solargraph/type_checker/rules.rb, line 40
def validate_calls?
  rank >= LEVELS[:strict]
end
validate_consts?() click to toggle source
# File lib/solargraph/type_checker/rules.rb, line 36
def validate_consts?
  rank >= LEVELS[:strict]
end
validate_tags?() click to toggle source
# File lib/solargraph/type_checker/rules.rb, line 52
def validate_tags?
  rank > LEVELS[:normal]
end