aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties1
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb8
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/resource/_duplications.html.erb12
3 files changed, 17 insertions, 4 deletions
diff --git a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
index f5416c41594..32e934c4bf0 100644
--- a/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
+++ b/plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
@@ -788,6 +788,7 @@ violations_viewer.review_filter.unreviewed_violations=Unreviewed violations
#------------------------------------------------------------------------------
duplications.no_duplicated_block=No duplicated blocks.
+duplications.dups_found_on_deleted_resource=This file contains duplicated blocks with some deleted resources. This project should be reanalyzed to remove these obsolete duplicated blocks.
duplications.blocks=Blocks
duplications.number_of_lines=Nb Lines
duplications.from_line=From line
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb
index 710b796937a..56a6adbb316 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb
@@ -282,6 +282,7 @@ class ResourceController < ApplicationController
def parse_duplications(dups, duplication_groups)
resource_by_key = {}
resource_by_key[@resource.key] = @resource
+ dups_found_on_deleted_resource = false
dups.elements.each("duplications/g") do |group|
dup_group = []
group.each_element("b") do |block|
@@ -292,10 +293,15 @@ class ResourceController < ApplicationController
resource = Project.by_key(resource_key)
resource_by_key[resource_key] = resource
end
- dup_group << {:resource => resource, :lines_count => block.attributes['l'], :from_line => block.attributes['s']} if resource
+ if resource
+ dup_group << {:resource => resource, :lines_count => block.attributes['l'], :from_line => block.attributes['s']}
+ else
+ dups_found_on_deleted_resource = true
+ end
end
duplication_groups << dup_group if dup_group.size > 1
end
+ @duplication_group_warning = message('duplications.dups_found_on_deleted_resource') if dups_found_on_deleted_resource
end
# Format before sonar 2.12
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_duplications.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_duplications.html.erb
index 3fc24f80bac..81bca4a8fbd 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_duplications.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_duplications.html.erb
@@ -1,8 +1,14 @@
-<% if @duplication_groups.empty? %>
+<%
+ if @duplication_groups.empty?
+ warning_message = message('duplications.no_duplicated_block')
+ warning_message = @duplication_group_warning if @duplication_group_warning
+%>
- <%= message('duplications.no_duplicated_block') -%>
+ <%= warning_message -%>
-<% else %>
+<% else %>
+
+ <%= @duplication_group_warning if @duplication_group_warning -%>
<table id="duplications" class="data">
<thead>