lib/rubocop/rbs/cop_base.rb in rubocop-on-rbs-0.5.0 vs lib/rubocop/rbs/cop_base.rb in rubocop-on-rbs-0.6.0
- old
+ new
@@ -49,13 +49,10 @@
end
if processed_rbs_source.error
on_rbs_parsing_error()
else
- # HACK: Autocorrector needs to clear diagnostics
- processed_source.diagnostics.clear
-
on_rbs_new_investigation()
processed_rbs_source.decls.each do |decl|
walk(decl)
end
@@ -110,9 +107,16 @@
range_between(location.start_pos, location.end_pos)
end
def tokenize(source)
::RBS::Parser.lex(source).value.reject { |t| t.type == :tTRIVIA }
+ end
+
+ private
+
+ # HACK: Required to autocorrect
+ def current_corrector
+ @current_corrector ||= RuboCop::Cop::Corrector.new(@processed_source) if @processed_rbs_source.valid_syntax?
end
end
end
end