diff options
author | Fabrice Bellingard <bellingard@gmail.com> | 2012-03-13 16:36:41 +0100 |
---|---|---|
committer | Fabrice Bellingard <bellingard@gmail.com> | 2012-03-13 16:36:41 +0100 |
commit | 6e080c04a7a0801e189f71ff7fac75511537c868 (patch) | |
tree | a68a0bb6b40d22163d27c602d1356a6bc7fa9ef6 | |
parent | 45dc3917fd114ab374f38da72d6e2075e21152ca (diff) | |
download | sonarqube-6e080c04a7a0801e189f71ff7fac75511537c868.tar.gz sonarqube-6e080c04a7a0801e189f71ff7fac75511537c868.zip |
SONAR-3277 Add message to inform about dups with deleted resources
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> |