From bad44ac24582da759ccbda5f5d4fe1a61b7df428 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Wed, 4 Mar 2015 11:13:31 +0100 Subject: [PATCH] Allow views to save any measure for remote views copy --- .../src/main/java/org/sonar/batch/index/DefaultIndex.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java index 0e2c128b185..393e8968ad9 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java @@ -242,7 +242,7 @@ public class DefaultIndex extends SonarIndex { if (metric == null) { throw new SonarException("Unknown metric: " + measure.getMetricKey()); } - if (!isTechnicalProjectCopy(resource) && !measure.isFromCore() && INTERNAL_METRICS.contains(metric)) { + if (!isViewResource(resource) && !measure.isFromCore() && INTERNAL_METRICS.contains(metric)) { LOG.debug("Metric " + metric.key() + " is an internal metric computed by SonarQube. Provided value is ignored."); return measure; } @@ -257,8 +257,9 @@ public class DefaultIndex extends SonarIndex { /** * Views plugin creates copy of technical projects and should be allowed to copy all measures even internal ones */ - private boolean isTechnicalProjectCopy(Resource resource) { - return Scopes.FILE.equals(resource.getScope()) && Qualifiers.PROJECT.equals(resource.getQualifier()); + private boolean isViewResource(Resource resource) { + boolean isTechnicalProject = Scopes.FILE.equals(resource.getScope()) && Qualifiers.PROJECT.equals(resource.getQualifier()); + return isTechnicalProject || ResourceUtils.isView(resource) || ResourceUtils.isSubview(resource); } // -- 2.39.5