MetricEvent (ScopeToolState tool, PluginInfo info) { if (!isSafeToReport(info)) { return null; } if (!(tool.getScopeName().equals(CustomScopesProviderEx.getAllScope().getScopeId()) && tool.getLevel().getSeverity().getName().equals(tool.getTool().getDefaultLevel().getSeverity().getName()))) { final String scopeId = tool.getScopeName(); final String severity = tool.getLevel().getName(); return NOT_DEFAULT_SCOPE_AND_SEVERITY.metric( INSPECTION_ID_FIELD.with(isSafeToReport(info) ? tool.getTool().getID() : "third.party"), SCOPE_FIELD.with(ALLOWED_SCOPES.contains(scopeId) ? scopeId : "custom"), SEVERITY_FIELD.with(ALLOWED_SEVERITIES.contains(severity) ? severity : "custom"), EventFields.PluginInfo.with(info) ); } return null; }