Class: Solargraph::Diagnostics::Rubocop
- Defined in:
- lib/solargraph/diagnostics/rubocop.rb
Overview
This reporter provides linting through RuboCop.
Constant Summary collapse
- SEVERITIES =
Conversion of RuboCop severity names to LSP constants
{ 'refactor' => Severities::HINT, 'convention' => Severities::INFORMATION, 'warning' => Severities::WARNING, 'error' => Severities::ERROR, 'fatal' => Severities::ERROR }
Instance Method Summary collapse
Instance Method Details
#diagnose(source, api_map) ⇒ Array<Hash>
21 22 23 24 25 26 27 28 |
# File 'lib/solargraph/diagnostics/rubocop.rb', line 21 def diagnose source, api_map , paths = (source.filename, source.code) runner = RuboCop::Runner.new(, RuboCop::ConfigStore.new) result = redirect_stdout{ runner.run(paths) } make_array JSON.parse(result) rescue JSON::ParserError raise DiagnosticsError, 'RuboCop returned invalid data' end |