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 diff --git a/test/rdjson_formatter/testdata/global_offenses.rb b/test/rdjson_formatter/testdata/global_offenses.rb new file mode 100644 index 0000000..e69de29