aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch/src/main/java
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2015-03-04 11:13:31 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2015-03-04 11:14:31 +0100
commitbad44ac24582da759ccbda5f5d4fe1a61b7df428 (patch)
tree08c31346954d543ccf8cc17bc39d339b85bc72b9 /sonar-batch/src/main/java
parent6ea6a3ebdc985caa40b59e6939cbf169812ecf1e (diff)
downloadsonarqube-bad44ac24582da759ccbda5f5d4fe1a61b7df428.tar.gz
sonarqube-bad44ac24582da759ccbda5f5d4fe1a61b7df428.zip
Allow views to save any measure for remote views copy
Diffstat (limited to 'sonar-batch/src/main/java')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/index/DefaultIndex.java7
1 files 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);
}
//