class Solargraph::TypeChecker::Rules
Definitions of type checking rules to be performed at various levels
Constants
- LEVELS
Attributes
@return [Symbol]
@return [Integer]
Public Class Methods
Source
# File lib/solargraph/type_checker/rules.rb, line 24 def initialize level, overrides @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)] @overrides = overrides end
@param level [Symbol] @param overrides [Hash{Symbol => Symbol}]
Public Instance Methods
Source
# File lib/solargraph/type_checker/rules.rb, line 35 def ignore_all_undefined? !report_undefined? end
Source
# File lib/solargraph/type_checker/rules.rb, line 55 def must_tag_or_infer? report?(:must_tag_or_infer, :strict) end
Source
# File lib/solargraph/type_checker/rules.rb, line 39 def report_undefined? report?(:report_undefined, :strict) end
Source
# File lib/solargraph/type_checker/rules.rb, line 63 def require_all_return_types_match_inferred? report?(:require_all_return_types_match_inferred, :alpha) end
Source
# File lib/solargraph/type_checker/rules.rb, line 47 def validate_calls? report?(:validate_calls, :strict) end
Source
# File lib/solargraph/type_checker/rules.rb, line 43 def validate_consts? report?(:validate_consts, :strict) end
Source
# File lib/solargraph/type_checker/rules.rb, line 71 def validate_sg_ignores? report?(:validate_sg_ignores, :strong) end
We keep this at strong because if you added an @ sg-ignore to address a strong-level issue, then ran at a lower level, youโd get a false positive - we donโt run stronger level checks than requested for performance reasons
Private Instance Methods
Source
# File lib/solargraph/type_checker/rules.rb, line 79 def report?(type, level) rank >= LEVELS[@overrides.fetch(type, level)] end
@param type [Symbol] @param level [Symbol]