Class: Solargraph::YardLint::Diagnostic
- Inherits:
-
Diagnostics::Base
- Object
- Diagnostics::Base
- Solargraph::YardLint::Diagnostic
- Includes:
- Helpers
- Defined in:
- lib/solargraph/yard_lint/diagnostic.rb
Overview
Solargraph diagnostic reporter backed by yard-lint.
Constant Summary collapse
- SEVERITIES =
Conversion of yard-lint severity names to LSP constants
{ 'convention' => Solargraph::Diagnostics::Severities::INFORMATION, 'warning' => Solargraph::Diagnostics::Severities::WARNING, 'error' => Solargraph::Diagnostics::Severities::ERROR }.freeze
Instance Method Summary collapse
Methods included from Helpers
Instance Method Details
#diagnose(source, _api_map) ⇒ Array<Hash{:range => Hash; :severity => Integer; :source, :code, :message => String}>
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/solargraph/yard_lint/diagnostic.rb', line 21 def diagnose source, _api_map @source = source return [] unless lintable?(source) require_yard_lint(yard_lint_version) result = Solargraph::CHDIR_MUTEX.synchronize do ::Yard::Lint.run(path: source.filename, progress: false) end return [] if result.clean? result.offenses.map { |off| offense_to_diagnostic(off) } rescue InvalidVersionError raise rescue StandardError => e raise Solargraph::DiagnosticsError, "Error running yard-lint: #{e.}" end |