Class: Solargraph::Diagnostics::TypeCheck
- Defined in:
- lib/solargraph/diagnostics/type_check.rb
Overview
TypeCheck reports methods with undefined return types, untagged parameters, and invalid param tags.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Solargraph::Diagnostics::Base
Instance Method Details
#diagnose(source, api_map) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/solargraph/diagnostics/type_check.rb', line 9 def diagnose source, api_map # return [] unless args.include?('always') || api_map.workspaced?(source.filename) severity = Diagnostics::Severities::ERROR level = (args.reverse.find { |a| ['normal', 'typed', 'strict', 'strong'].include?(a) }) || :normal checker = Solargraph::TypeChecker.new(source.filename, api_map: api_map, level: level.to_sym) checker.problems .sort { |a, b| a.location.range.start.line <=> b.location.range.start.line } .map do |problem| { range: extract_first_line(problem.location, source), severity: severity, source: 'Typecheck', message: problem. } end end |