class Solargraph::Diagnostics::Rubocop

def offense_to_diagnostic off

Returns:
  • (Hash{Symbol => Hash, String, Integer}) - LSP diagnostic

Parameters:
  • off (Hash{String => unknown}) -- Offense received from Rubocop
def offense_to_diagnostic off
  {
    range: offense_range(off).to_hash,
    # 1 = Error, 2 = Warning, 3 = Information, 4 = Hint

    severity: SEVERITIES[off['severity']],
    source: 'rubocop',
    code: off['cop_name'],
    message: off['message'].gsub(/^#{off['cop_name']}\:/, '')
  }
end