From c609128b8c92b89a6f21d699d222a7a091c6e9e0 Mon Sep 17 00:00:00 2001 From: ohbarye Date: Fri, 19 Nov 2021 00:41:35 +0900 Subject: [PATCH] Skip global offense that does not have any location --- rdjson_formatter/rdjson_formatter.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rdjson_formatter/rdjson_formatter.rb b/rdjson_formatter/rdjson_formatter.rb index 630e608..2026a5d 100644 --- a/rdjson_formatter/rdjson_formatter.rb +++ b/rdjson_formatter/rdjson_formatter.rb @@ -16,6 +16,8 @@ def started(_target_files) def file_finished(file, offenses) offenses.each do |offense| + next if offense.location == RuboCop::Cop::Offense::NO_LOCATION + @rdjson[:diagnostics] << build_diagnostic(file, offense) end end