Class: RuboCop::Cop::RBS::Lint::Syntax

Inherits:
RBS::CopBase show all
Defined in:
lib/rubocop/cop/rbs/lint/syntax.rb

Overview

Just only for syntax error

Instance Attribute Summary

Attributes inherited from RBS::CopBase

#processed_rbs_source

Instance Method Summary collapse

Methods inherited from RBS::CopBase

#investigation_rbs, #location_to_range, #on_new_investigation, #on_other_file, #on_rbs_attribute, #on_rbs_class, #on_rbs_constant, #on_rbs_def, #on_rbs_global, #on_rbs_interface, #on_rbs_module, #on_rbs_new_investigation, #on_rbs_private, #on_rbs_public, #on_rbs_type_alias, #on_rbs_var, #parse_rbs, #rbs_buffer, #tokenize, #walk

Methods included from RBS::OnTypeHelper

#on_not_type, #on_type

Instance Method Details

#on_rbs_parsing_errorObject



9
10
11
12
13
# File 'lib/rubocop/cop/rbs/lint/syntax.rb', line 9

def on_rbs_parsing_error
  e = processed_rbs_source.error or raise
  message = "#{e.error_message}, token=`#{e.location.source}` (#{e.token_type})"
  add_offense(location_to_range(e.location), message:, severity: :fatal)
end