From: simonbrandhof Date: Wed, 15 Dec 2010 14:35:33 +0000 (+0000) Subject: SONAR-249 rename FILTERS.VARIATION_INDEX to FILTERS.PERIOD_INDEX + support variations... X-Git-Tag: 2.6~301 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9e75d602fcaf9975d945224ec1548a143c77c5b3;p=sonarqube.git SONAR-249 rename FILTERS.VARIATION_INDEX to FILTERS.PERIOD_INDEX + support variations in the resources web service + add IT --- diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/PastSnapshotFinder.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/PastSnapshotFinder.java index 15397c8097e..2fda1618ed0 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/PastSnapshotFinder.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/PastSnapshotFinder.java @@ -30,7 +30,7 @@ import java.util.Date; public class PastSnapshotFinder implements BatchExtension { /** - * IMPORTANT : please update default values in the ruby side too. See app/helpers/FiltersHelper.rb + * IMPORTANT : please update default values in the ruby side too. See app/helpers/FiltersHelper.rb, method period_names() */ public static final String DEFAULT_VALUE_1 = PastSnapshotFinderByPreviousAnalysis.MODE; public static final String DEFAULT_VALUE_2 = "5"; diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/code_coverage.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/code_coverage.html.erb index 86506a2a9c2..3bab79d5aeb 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/code_coverage.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/code_coverage.html.erb @@ -13,37 +13,37 @@

Code coverage

<%= format_measure(code_coverage_measure, :suffix => '', :url => url_for_drilldown(Metric::COVERAGE), :default => '-') %> - <%= dashboard_configuration.variation? ? format_variation(code_coverage_measure) : trend_icon(code_coverage_measure) -%> + <%= dashboard_configuration.selected_period? ? format_variation(code_coverage_measure) : trend_icon(code_coverage_measure) -%>

<% line_coverage=measure(Metric::LINE_COVERAGE) if line_coverage %>

<%= format_measure(line_coverage, :suffix => ' line coverage', :url => url_for_drilldown(Metric::UNCOVERED_LINES, :highlight => Metric::LINE_COVERAGE)) %> - <%= dashboard_configuration.variation? ? format_variation(line_coverage) : trend_icon(line_coverage) -%> + <%= dashboard_configuration.selected_period? ? format_variation(line_coverage) : trend_icon(line_coverage) -%>

<% end %> <% branch_coverage=measure(Metric::BRANCH_COVERAGE) if branch_coverage %>

<%= format_measure(branch_coverage, :suffix => ' branch coverage', :url => url_for_drilldown(Metric::UNCOVERED_CONDITIONS, :highlight => Metric::BRANCH_COVERAGE)) %> - <%= dashboard_configuration.variation? ? format_variation(branch_coverage) : trend_icon(branch_coverage) -%> + <%= dashboard_configuration.selected_period? ? format_variation(branch_coverage) : trend_icon(branch_coverage) -%>

<% end %>

<%= format_measure(tests_measure, :suffix => ' tests', :url => url_for_drilldown(Metric::TESTS)) %> - <%= dashboard_configuration.variation? ? format_variation(tests_measure) : trend_icon(tests_measure) -%> + <%= dashboard_configuration.selected_period? ? format_variation(tests_measure) : trend_icon(tests_measure) -%>

<% skipped_measure=measure(Metric::SKIPPED_TESTS) if skipped_measure %>

+<%= format_measure(skipped_measure, :suffix => ' skipped', :url => url_for_drilldown(Metric::SKIPPED_TESTS)) %> - <%= dashboard_configuration.variation? ? format_variation(skipped_measure) : trend_icon(skipped_measure) -%> + <%= dashboard_configuration.selected_period? ? format_variation(skipped_measure) : trend_icon(skipped_measure) -%>

<% end %>

<%= format_measure(execution_time, :suffix => '', :url => url_for_drilldown(Metric::TEST_EXECUTION_TIME)) %> - <%= dashboard_configuration.variation? ? format_variation(execution_time) : trend_icon(execution_time) -%> + <%= dashboard_configuration.selected_period? ? format_variation(execution_time) : trend_icon(execution_time) -%>

@@ -55,15 +55,15 @@

Test success

<%= format_measure(success_percentage, :suffix => '', :url => url_for_drilldown(success_percentage)) %> - <%= dashboard_configuration.variation? ? format_variation(success_percentage) : trend_icon(success_percentage) -%> + <%= dashboard_configuration.selected_period? ? format_variation(success_percentage) : trend_icon(success_percentage) -%>

<%= format_measure(Metric::TEST_FAILURES, :suffix => ' failures', :url => url_for_drilldown(Metric::TEST_FAILURES)) %> - <%= dashboard_configuration.variation? ? format_variation(Metric::TEST_FAILURES) : trend_icon(Metric::TEST_FAILURES) -%> + <%= dashboard_configuration.selected_period? ? format_variation(Metric::TEST_FAILURES) : trend_icon(Metric::TEST_FAILURES) -%>

<%= format_measure(Metric::TEST_ERRORS, :suffix => ' errors', :url => url_for_drilldown(Metric::TEST_ERRORS)) %> - <%= dashboard_configuration.variation? ? format_variation(Metric::TEST_ERRORS) : trend_icon(Metric::TEST_ERRORS) -%> + <%= dashboard_configuration.selected_period? ? format_variation(Metric::TEST_ERRORS) : trend_icon(Metric::TEST_ERRORS) -%>

<% end %> diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/comments_duplications.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/comments_duplications.html.erb index 0f884137877..49fd737da89 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/comments_duplications.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/comments_duplications.html.erb @@ -19,30 +19,30 @@

Comments

<%= format_measure(comment_lines_density, :suffix => '', :url => url_for_drilldown(comment_lines_density)) %> - <%= dashboard_configuration.variation? ? format_variation(comment_lines_density) : trend_icon(comment_lines_density) -%> + <%= dashboard_configuration.selected_period? ? format_variation(comment_lines_density) : trend_icon(comment_lines_density) -%>

<%= format_measure(comment_lines, :suffix => ' lines', :url => url_for_drilldown(comment_lines)) %> - <%= dashboard_configuration.variation? ? format_variation(comment_lines) : trend_icon(comment_lines) -%> + <%= dashboard_configuration.selected_period? ? format_variation(comment_lines) : trend_icon(comment_lines) -%>

<% if comment_blank_lines && comment_blank_lines.value>0 %>

+<%= format_measure(comment_blank_lines, :suffix => ' blank', :url => url_for_drilldown(comment_blank_lines)) %> - <%= dashboard_configuration.variation? ? format_variation(comment_blank_lines) : trend_icon(comment_blank_lines) -%> + <%= dashboard_configuration.selected_period? ? format_variation(comment_blank_lines) : trend_icon(comment_blank_lines) -%>

<% end %>

<%= format_measure(public_documented_api_density, :suffix => ' docu. API', :url => url_for_drilldown(Metric::PUBLIC_UNDOCUMENTED_API, :highlight => Metric::PUBLIC_DOCUMENTED_API_DENSITY)) %> - <%= dashboard_configuration.variation? ? format_variation(public_documented_api_density) : trend_icon(public_documented_api_density) -%> + <%= dashboard_configuration.selected_period? ? format_variation(public_documented_api_density) : trend_icon(public_documented_api_density) -%>

<%= format_measure(public_undocumented_api, :suffix => ' undocu. API', :url => url_for_drilldown(public_undocumented_api)) %> - <%= dashboard_configuration.variation? ? format_variation(public_undocumented_api) : trend_icon(public_undocumented_api) -%> + <%= dashboard_configuration.selected_period? ? format_variation(public_undocumented_api) : trend_icon(public_undocumented_api) -%>

<%= format_measure(commented_out_lines, :suffix => ' commented LOCs', :url => url_for_drilldown(commented_out_lines)) %> - <%= dashboard_configuration.variation? ? format_variation(commented_out_lines) : trend_icon(commented_out_lines) -%> + <%= dashboard_configuration.selected_period? ? format_variation(commented_out_lines) : trend_icon(commented_out_lines) -%>

<% end %> @@ -53,19 +53,19 @@

Duplications

<%= format_measure(duplicated_lines_density, :suffix => '', :url => url_for_drilldown(Metric::DUPLICATED_LINES, :highlight => 'duplicated_lines_density')) %> - <%= dashboard_configuration.variation? ? format_variation(duplicated_lines_density) : trend_icon(duplicated_lines_density) -%> + <%= dashboard_configuration.selected_period? ? format_variation(duplicated_lines_density) : trend_icon(duplicated_lines_density) -%>

<%= format_measure(duplicated_lines, :suffix => ' lines', :url => url_for_drilldown(duplicated_lines)) %> - <%= dashboard_configuration.variation? ? format_variation(duplicated_lines) : trend_icon(duplicated_lines) -%> + <%= dashboard_configuration.selected_period? ? format_variation(duplicated_lines) : trend_icon(duplicated_lines) -%>

<%= format_measure(duplicated_blocks, :suffix => ' blocks', :url => url_for_drilldown(duplicated_blocks)) %> - <%= dashboard_configuration.variation? ? format_variation(duplicated_blocks) : trend_icon(duplicated_blocks) -%> + <%= dashboard_configuration.selected_period? ? format_variation(duplicated_blocks) : trend_icon(duplicated_blocks) -%>

<%= format_measure(duplicated_files, :suffix => ' files', :url => url_for_drilldown(duplicated_files)) %> - <%= dashboard_configuration.variation? ? format_variation(duplicated_files) : trend_icon(duplicated_files) -%> + <%= dashboard_configuration.selected_period? ? format_variation(duplicated_files) : trend_icon(duplicated_files) -%>

<% end %> diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/complexity.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/complexity.html.erb index 9b25bfb986a..89cbda07795 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/complexity.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/complexity.html.erb @@ -17,30 +17,30 @@ complexity=measure('complexity') <% if function_complexity %>

<%= format_measure(function_complexity, :suffix => '', :url => url_for_drilldown(function_complexity)) -%>/ method - <%= dashboard_configuration.variation? ? format_variation(function_complexity) : trend_icon(function_complexity) -%> + <%= dashboard_configuration.selected_period? ? format_variation(function_complexity) : trend_icon(function_complexity) -%>

<% end %> <% if paragraph_complexity %>

<%= format_measure(paragraph_complexity, :suffix => '', :url => url_for_drilldown(paragraph_complexity)) -%>/ paragraph - <%= dashboard_configuration.variation? ? format_variation(paragraph_complexity) : trend_icon(paragraph_complexity) -%> + <%= dashboard_configuration.selected_period? ? format_variation(paragraph_complexity) : trend_icon(paragraph_complexity) -%>

<% end %> <% if class_complexity %>

<%= format_measure(class_complexity, :suffix => '', :url => url_for_drilldown(class_complexity)) -%>/ class - <%= dashboard_configuration.variation? ? format_variation(class_complexity) : trend_icon(class_complexity) -%> + <%= dashboard_configuration.selected_period? ? format_variation(class_complexity) : trend_icon(class_complexity) -%>

<% end %> <% if file_complexity %>

<%= format_measure(file_complexity, :suffix => '', :url => url_for_drilldown(file_complexity)) -%>/ file - <%= dashboard_configuration.variation? ? format_variation(file_complexity) : trend_icon(file_complexity) -%> + <%= dashboard_configuration.selected_period? ? format_variation(file_complexity) : trend_icon(file_complexity) -%>

<% end %> <% if complexity %>

- Total: <%= format_measure(complexity, :url => url_for_drilldown(complexity)) -%> <%= dashboard_configuration.variation? ? format_variation(complexity) : trend_icon(complexity) -%> + Total: <%= format_measure(complexity, :url => url_for_drilldown(complexity)) -%> <%= dashboard_configuration.selected_period? ? format_variation(complexity) : trend_icon(complexity) -%>

<% end %> diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/rules.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/rules.html.erb index 63d343b3c55..ca4d29d1818 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/rules.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/rules.html.erb @@ -16,22 +16,22 @@ <%= format_measure(violations, :url => url_for(:controller => 'drilldown', :action => 'violations', :id => @project.key)) -%> - <%= dashboard_configuration.variation? ? format_variation(violations) : trend_icon(violations) -%> + <%= dashboard_configuration.selected_period? ? format_variation(violations) : trend_icon(violations) -%>

Rules compliance

<%= format_measure(density, :url => url_for_drilldown(Metric::WEIGHTED_VIOLATIONS, {:highlight => Metric::WEIGHTED_VIOLATIONS})) -%> - <%= dashboard_configuration.variation? ? format_variation(density) : trend_icon(density) -%> + <%= dashboard_configuration.selected_period? ? format_variation(density) : trend_icon(density) -%>
<% values=[blocker_violations,critical_violations,major_violations,minor_violations,info_violations] - if dashboard_configuration.variation? - values=values.map{|m| m ? (m.variation(dashboard_configuration.variation_index)||0) : 0} + if dashboard_configuration.selected_period? + values=values.map{|m| m ? (m.variation(dashboard_configuration.period_index)||0) : 0} else values=values.map{|m| m ? (m.value||0) : 0} end @@ -45,11 +45,11 @@ <%= format_measure(blocker_violations) -%> - <%= dashboard_configuration.variation? ? format_variation(blocker_violations) : trend_icon(blocker_violations, :empty => true) -%> + <%= dashboard_configuration.selected_period? ? format_variation(blocker_violations) : trend_icon(blocker_violations, :empty => true) -%> <% if max > 0 %> - <% if dashboard_configuration.variation? %> + <% if dashboard_configuration.selected_period? %> <%= barchart(:width => 35, :percent => (values[0]<0 ? (100 * values[0] / max).to_i : 0), :color => '#078C00') %> <%= barchart(:width => 35, :percent => (values[0]>0 ? (100 * values[0] / max).to_i : 0), :color => '#cc0000') %> <% else %> @@ -65,11 +65,11 @@ <%= format_measure(critical_violations) -%> - <%= dashboard_configuration.variation? ? format_variation(critical_violations) : trend_icon(critical_violations, :empty => true) -%> + <%= dashboard_configuration.selected_period? ? format_variation(critical_violations) : trend_icon(critical_violations, :empty => true) -%> <% if max > 0 %> - <% if dashboard_configuration.variation? %> + <% if dashboard_configuration.selected_period? %> <%= barchart(:width => 35, :percent => (values[1]<0 ? (100 * values[1] / max).to_i : 0), :color => '#078C00') %> <%= barchart(:width => 35, :percent => (values[1]>0 ? (100 * values[1] / max).to_i : 0), :color => '#cc0000') %> <% else %> @@ -85,11 +85,11 @@ <%= format_measure(major_violations) -%> - <%= dashboard_configuration.variation? ? format_variation(major_violations) : trend_icon(major_violations, :empty => true) -%> + <%= dashboard_configuration.selected_period? ? format_variation(major_violations) : trend_icon(major_violations, :empty => true) -%> <% if max > 0 %> - <% if dashboard_configuration.variation? %> + <% if dashboard_configuration.selected_period? %> <%= barchart(:width => 35, :percent => (values[2]<0 ? (100 * values[2] / max).to_i : 0), :color => '#078C00') %> <%= barchart(:width => 35, :percent => (values[2]>0 ? (100 * values[2] / max).to_i : 0), :color => '#cc0000') %> <% else %> @@ -105,11 +105,11 @@ <%= format_measure(minor_violations) -%> - <%= dashboard_configuration.variation? ? format_variation(minor_violations) : trend_icon(minor_violations, :empty => true) -%> + <%= dashboard_configuration.selected_period? ? format_variation(minor_violations) : trend_icon(minor_violations, :empty => true) -%> <% if max > 0 %> - <% if dashboard_configuration.variation? %> + <% if dashboard_configuration.selected_period? %> <%= barchart(:width => 35, :percent => (values[3]<0 ? (100 * values[3] / max).to_i : 0), :color => '#078C00') %> <%= barchart(:width => 35, :percent => (values[3]>0 ? (100 * values[3] / max).to_i : 0), :color => '#cc0000') %> <% else %> @@ -125,11 +125,11 @@ <%= format_measure(info_violations) -%> - <%= dashboard_configuration.variation? ? format_variation(info_violations) : trend_icon(info_violations, :empty => true) -%> + <%= dashboard_configuration.selected_period? ? format_variation(info_violations) : trend_icon(info_violations, :empty => true) -%> <% if max > 0 %> - <% if dashboard_configuration.variation? %> + <% if dashboard_configuration.selected_period? %> <%= barchart(:width => 35, :percent => (values[4]<0 ? (100 * values[4] / max).to_i : 0), :color => '#078C00') %> <%= barchart(:width => 35, :percent => (values[4]>0 ? (100 * values[4] / max).to_i : 0), :color => '#cc0000') %> <% else %> diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/size.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/size.html.erb index dd01dc4e715..d0d821feabd 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/size.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/size.html.erb @@ -17,15 +17,15 @@ <% if ncloc %>

<%= format_measure(ncloc, :suffix => '', :url => url_for_drilldown(ncloc)) -%> - <%= dashboard_configuration.variation? ? format_variation(ncloc) : trend_icon(ncloc) -%> + <%= dashboard_configuration.selected_period? ? format_variation(ncloc) : trend_icon(ncloc) -%>

<% generated_ncloc=measure('generated_ncloc') if generated_ncloc && generated_ncloc.value>0 %> -

+<%= format_measure(generated_ncloc, :suffix => ' generated', :url => url_for_drilldown(generated_ncloc)) -%> <%= dashboard_configuration.variation? ? format_variation(generated_ncloc) : trend_icon(generated_ncloc) -%>

+

+<%= format_measure(generated_ncloc, :suffix => ' generated', :url => url_for_drilldown(generated_ncloc)) -%> <%= dashboard_configuration.selected_period? ? format_variation(generated_ncloc) : trend_icon(generated_ncloc) -%>

<% end %> -

<%= format_measure(lines, :suffix => ' lines', :url => url_for_drilldown(lines)) -%> <%= dashboard_configuration.variation? ? format_variation(lines) : trend_icon(lines) -%>

+

<%= format_measure(lines, :suffix => ' lines', :url => url_for_drilldown(lines)) -%> <%= dashboard_configuration.selected_period? ? format_variation(lines) : trend_icon(lines) -%>

<% else%>

<%= format_measure(lines, :suffix => '', :url => url_for_drilldown(lines)) -%> <%= trend_icon(lines) -%>

<% end %> @@ -33,15 +33,15 @@ generated_lines=measure('generated_lines') if generated_lines && generated_lines.value>0 %> -

incl. <%= format_measure(generated_lines, :suffix => ' generated', :url => url_for_drilldown(generated_lines)) -%> <%= dashboard_configuration.variation? ? format_variation(generated_lines) : trend_icon(generated_lines) -%>

+

incl. <%= format_measure(generated_lines, :suffix => ' generated', :url => url_for_drilldown(generated_lines)) -%> <%= dashboard_configuration.selected_period? ? format_variation(generated_lines) : trend_icon(generated_lines) -%>

<% end %> <% if statements %>

- <%= format_measure(statements, :suffix => ' statements', :url => url_for_drilldown(statements)) -%> <%= dashboard_configuration.variation? ? format_variation(statements) : trend_icon(statements) -%> + <%= format_measure(statements, :suffix => ' statements', :url => url_for_drilldown(statements)) -%> <%= dashboard_configuration.selected_period? ? format_variation(statements) : trend_icon(statements) -%>

<% end %> <% if files && measure('classes') %> -

<%= format_measure(files, :suffix => ' files', :url => url_for_drilldown(files)) -%> <%= dashboard_configuration.variation? ? format_variation(files) : trend_icon(files) -%>

+

<%= format_measure(files, :suffix => ' files', :url => url_for_drilldown(files)) -%> <%= dashboard_configuration.selected_period? ? format_variation(files) : trend_icon(files) -%>

<% end %> @@ -52,25 +52,25 @@

Classes

<%= format_measure(classes, :url => url_for_drilldown(classes)) -%> - <%= dashboard_configuration.variation? ? format_variation(classes) : trend_icon(classes) -%> + <%= dashboard_configuration.selected_period? ? format_variation(classes) : trend_icon(classes) -%>

-

<%= format_measure(packages, :suffix => ' packages', :url => url_for_drilldown(packages)) -%> <%= dashboard_configuration.variation? ? format_variation(packages) : trend_icon(packages) -%>

+

<%= format_measure(packages, :suffix => ' packages', :url => url_for_drilldown(packages)) -%> <%= dashboard_configuration.selected_period? ? format_variation(packages) : trend_icon(packages) -%>

<% else %>

Files

<%= format_measure(files, :url => url_for_drilldown(files)) -%> - <%= dashboard_configuration.variation? ? format_variation(files) : trend_icon(files) -%> + <%= dashboard_configuration.selected_period? ? format_variation(files) : trend_icon(files) -%>

-

<%= format_measure('directories', :suffix => ' directories', :url => url_for_drilldown('directories')) -%> <%= dashboard_configuration.variation? ? format_variation('directories') : trend_icon('directories') -%>

+

<%= format_measure('directories', :suffix => ' directories', :url => url_for_drilldown('directories')) -%> <%= dashboard_configuration.selected_period? ? format_variation('directories') : trend_icon('directories') -%>

<% end %> -

<%= format_measure(functions, :suffix => ' methods', :url => url_for_drilldown(functions)) -%> <%= dashboard_configuration.variation? ? format_variation(functions) : trend_icon(functions) -%>

+

<%= format_measure(functions, :suffix => ' methods', :url => url_for_drilldown(functions)) -%> <%= dashboard_configuration.selected_period? ? format_variation(functions) : trend_icon(functions) -%>

<% if (measure('accessors')) - prefix=(dashboard_configuration.variation? ? '' : '+') + prefix=(dashboard_configuration.selected_period? ? '' : '+') %> -

<%= format_measure('accessors', :prefix => prefix, :suffix => ' accessors', :url => url_for_drilldown('accessors')) -%> <%= dashboard_configuration.variation? ? format_variation('accessors') : trend_icon('accessors') -%>

+

<%= format_measure('accessors', :prefix => prefix, :suffix => ' accessors', :url => url_for_drilldown('accessors')) -%> <%= dashboard_configuration.selected_period? ? format_variation('accessors') : trend_icon('accessors') -%>

<% end %> <% if measure('paragraphs') %> -

<%= format_measure('paragraphs', :suffix => ' paragraphs', :url => url_for_drilldown('paragraphs')) -%> <%= dashboard_configuration.variation? ? format_variation('paragraphs') : trend_icon('paragraphs') -%>

+

<%= format_measure('paragraphs', :suffix => ' paragraphs', :url => url_for_drilldown('paragraphs')) -%> <%= dashboard_configuration.selected_period? ? format_variation('paragraphs') : trend_icon('paragraphs') -%>

<% end %> diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/chidamber_kemerer.html.erb b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/chidamber_kemerer.html.erb index d1582f9d3c6..c23b968784b 100644 --- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/chidamber_kemerer.html.erb +++ b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/chidamber_kemerer.html.erb @@ -14,10 +14,10 @@ if lcom || rfc

LCOM4

- <%= format_measure(lcom, :suffix => '', :default => '-', :url => url_for_drilldown('lcom4')) -%> /class <%= dashboard_configuration.variation? ? format_variation(lcom) : trend_icon(lcom, :big => true) -%> + <%= format_measure(lcom, :suffix => '', :default => '-', :url => url_for_drilldown('lcom4')) -%> /class <%= dashboard_configuration.selected_period? ? format_variation(lcom) : trend_icon(lcom, :big => true) -%>

- <%= format_measure(suspect_lcom4_density, :suffix => ' files having LCOM4>1', :url => url_for_drilldown('lcom4')) %> <%= dashboard_configuration.variation? ? format_variation(suspect_lcom4_density) : trend_icon(suspect_lcom4_density) -%> + <%= format_measure(suspect_lcom4_density, :suffix => ' files having LCOM4>1', :url => url_for_drilldown('lcom4')) %> <%= dashboard_configuration.selected_period? ? format_variation(suspect_lcom4_density) : trend_icon(suspect_lcom4_density) -%>

@@ -27,7 +27,7 @@ if lcom || rfc

RFC

- <%= format_measure(rfc, :suffix => '', :default => '-', :url => url_for_drilldown('rfc')) -%> /class <%= dashboard_configuration.variation? ? format_variation(rfc) : trend_icon(rfc, :big => true) -%> + <%= format_measure(rfc, :suffix => '', :default => '-', :url => url_for_drilldown('rfc')) -%> /class <%= dashboard_configuration.selected_period? ? format_variation(rfc) : trend_icon(rfc, :big => true) -%>

diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/file_design.html.erb b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/file_design.html.erb index fd30f977a44..512a743c133 100644 --- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/file_design.html.erb +++ b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/file_design.html.erb @@ -11,11 +11,11 @@

File tangle index

- <%= format_measure(file_tangle_index, :suffix => '', :default => '-', :url => url_for_drilldown('file_tangle_index')) -%> <%= dashboard_configuration.variation? ? format_variation(file_tangle_index) : trend_icon(file_tangle_index, :big => true) -%> + <%= format_measure(file_tangle_index, :suffix => '', :default => '-', :url => url_for_drilldown('file_tangle_index')) -%> <%= dashboard_configuration.selected_period? ? format_variation(file_tangle_index) : trend_icon(file_tangle_index, :big => true) -%>

<% if file_cycles %>

- > <%= format_measure(file_cycles, :suffix => ' cycles', :url => url_for_drilldown('file_cycles')) %> <%= dashboard_configuration.variation? ? format_variation(file_cycles) : trend_icon(file_cycles) -%> + > <%= format_measure(file_cycles, :suffix => ' cycles', :url => url_for_drilldown('file_cycles')) %> <%= dashboard_configuration.selected_period? ? format_variation(file_cycles) : trend_icon(file_cycles) -%>

<% end %>
@@ -25,7 +25,7 @@

Suspect file dependencies

- <%= format_measure(file_feedback_edges, :url => url_for_drilldown('file_feedback_edges')) -%> <%= dashboard_configuration.variation? ? format_variation(file_feedback_edges) : trend_icon(file_feedback_edges, :big => true) -%> + <%= format_measure(file_feedback_edges, :url => url_for_drilldown('file_feedback_edges')) -%> <%= dashboard_configuration.selected_period? ? format_variation(file_feedback_edges) : trend_icon(file_feedback_edges, :big => true) -%>

<% end %> diff --git a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/package_design.html.erb b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/package_design.html.erb index 10380f4f8cf..3e2611d33e5 100644 --- a/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/package_design.html.erb +++ b/plugins/sonar-design-plugin/src/main/resources/org/sonar/plugins/design/ui/widgets/package_design.html.erb @@ -15,11 +15,11 @@

Package tangle index

- <%= format_measure(package_tangle_index, :suffix => '', :default => '-', :url => url_for_drilldown('package_tangle_index')) -%> <%= dashboard_configuration.variation? ? format_variation(package_tangle_index) : trend_icon(package_tangle_index, :big => true) -%> + <%= format_measure(package_tangle_index, :suffix => '', :default => '-', :url => url_for_drilldown('package_tangle_index')) -%> <%= dashboard_configuration.selected_period? ? format_variation(package_tangle_index) : trend_icon(package_tangle_index, :big => true) -%>

<% if package_cycles %>

- > <%= format_measure(package_cycles, :suffix => ' cycles', :url => url_for_drilldown('package_cycles')) %> <%= dashboard_configuration.variation? ? format_variation(package_cycles) : trend_icon(package_cycles) -%> + > <%= format_measure(package_cycles, :suffix => ' cycles', :url => url_for_drilldown('package_cycles')) %> <%= dashboard_configuration.selected_period? ? format_variation(package_cycles) : trend_icon(package_cycles) -%>

<% end %>
@@ -30,11 +30,11 @@

Dependencies to cut

<%= format_measure(package_feedback_edges, :suffix => ' between packages', :url => url_for_drilldown('package_feedback_edges')) %> - <%= dashboard_configuration.variation? ? format_variation(package_feedback_edges) : trend_icon(package_feedback_edges) -%> + <%= dashboard_configuration.selected_period? ? format_variation(package_feedback_edges) : trend_icon(package_feedback_edges) -%>

<%= format_measure(package_tangles, :suffix => ' between files', :url => url_for_drilldown('package_tangles')) %> - <%= dashboard_configuration.variation? ? format_variation(package_tangles) : trend_icon(package_tangles) -%> + <%= dashboard_configuration.selected_period? ? format_variation(package_tangles) : trend_icon(package_tangles) -%>

<% end %> diff --git a/pom.xml b/pom.xml index cec5aa37a45..4032ae53415 100644 --- a/pom.xml +++ b/pom.xml @@ -154,6 +154,11 @@ maven-enforcer-plugin 1.0 + + org.apache.maven.plugins + maven-failsafe-plugin + 2.6 + org.codehaus.mojo gwt-maven-plugin diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb index 83097d23c35..2daf8b9d568 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb @@ -350,9 +350,16 @@ class Api::ResourcesController < Api::ApiController json_measure[:alert]=measure.alert_status json_measure[:alert_text]=measure.alert_text end - if include_trends && measure.tendency - json_measure[:trend]=measure.tendency_qualitative - json_measure[:var]=measure.tendency + if include_trends + if measure.tendency + json_measure[:trend]=measure.tendency_qualitative + json_measure[:var]=measure.tendency + end + json_measure[:var1]=measure.variation_value_1.to_f if measure.variation_value_1 + json_measure[:var2]=measure.variation_value_2.to_f if measure.variation_value_2 + json_measure[:var3]=measure.variation_value_3.to_f if measure.variation_value_3 + json_measure[:var4]=measure.variation_value_4.to_f if measure.variation_value_4 + json_measure[:var5]=measure.variation_value_5.to_f if measure.variation_value_5 end if measure.rule_id rule = rules_by_id[measure.rule_id] @@ -391,6 +398,29 @@ class Api::ResourcesController < Api::ApiController xml.date(format_datetime(snapshot.created_at)) xml.description(resource.description) if include_descriptions && resource.description xml.copy(resource.copy_resource_id) if resource.copy_resource_id + + if include_trends + xml.period1(snapshot.period1_mode) if snapshot.period1_mode + xml.period1_param(snapshot.period1_param) if snapshot.period1_param + xml.period1_date(format_datetime(snapshot.period1_date)) if snapshot.period1_date + + xml.period2(snapshot.period2_mode) if snapshot.period2_mode + xml.period2_param(snapshot.period2_param) if snapshot.period2_param + xml.period2_date(format_datetime(snapshot.period2_date)) if snapshot.period2_date + + xml.period3(snapshot.period3_mode) if snapshot.period3_mode + xml.period3_param(snapshot.period3_param) if snapshot.period3_param + xml.period3_date(format_datetime(snapshot.period3_date)) if snapshot.period3_date + + xml.period4(snapshot.period4_mode) if snapshot.period4_mode + xml.period4_param(snapshot.period4_param) if snapshot.period4_param + xml.period4_date(format_datetime(snapshot.period4_date)) if snapshot.period4_date + + xml.period5(snapshot.period5_mode) if snapshot.period5_mode + xml.period5_param(snapshot.period5_param) if snapshot.period5_param + xml.period5_date(format_datetime(snapshot.period5_date)) if snapshot.period5_date + end + if measures measures.each do |measure| xml.msr do @@ -405,9 +435,16 @@ class Api::ResourcesController < Api::ApiController xml.alert(measure.alert_status) if measure.alert_status xml.alert_text(measure.alert_text) if measure.alert_text end - if include_trends && measure.tendency - xml.trend(measure.tendency_qualitative) - xml.var(measure.tendency) + if include_trends + if measure.tendency + xml.trend(measure.tendency_qualitative) + xml.var(measure.tendency) + end + xml.var1(measure.variation_value_1.to_f) if measure.variation_value_1 + xml.var2(measure.variation_value_2.to_f) if measure.variation_value_2 + xml.var3(measure.variation_value_3.to_f) if measure.variation_value_3 + xml.var4(measure.variation_value_4.to_f) if measure.variation_value_4 + xml.var5(measure.variation_value_5.to_f) if measure.variation_value_5 end if measure.rule_id rule = rules_by_id[measure.rule_id] diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb index 2ac65f9e3ba..c56dab9ba68 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/dashboard_controller.rb @@ -169,7 +169,7 @@ class DashboardController < ApplicationController end end @dashboard=(@active ? @active.dashboard : nil) - @dashboard_configuration=Api::DashboardConfiguration.new(@dashboard, :variation_index => params[:var]) + @dashboard_configuration=Api::DashboardConfiguration.new(@dashboard, :period_index => params[:period]) end def load_resource diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb index f5fb0714d83..636f55c531e 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/drilldown_controller.rb @@ -65,11 +65,11 @@ class DrilldownController < ApplicationController @rule=Rule.by_key_or_id(params[:rule]) # variation measures - if params[:var].blank? - @variation_index=nil + if params[:period].blank? + @period_index=nil metric_prefix = '' else - @variation_index=params[:var].to_i + @period_index=params[:period].to_i metric_prefix = 'new_' end @@ -93,7 +93,7 @@ class DrilldownController < ApplicationController # options for Drilldown - options={:exclude_zero_value => true, :variation_index => @variation_index} + options={:exclude_zero_value => true, :period_index => @period_index} if @rule params[:rule]=@rule.key # workaround for SONAR-1767 : the javascript hash named "rp" in the HTML source must contain the rule key, but not the rule id options[:rule_id]=@rule.id diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/filters_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/filters_controller.rb index d1be0ad873e..30cc0c01038 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/filters_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/filters_controller.rb @@ -51,8 +51,8 @@ class FiltersController < ApplicationController load_filter_from_params(@filter, params) @filter.columns.build(:family => 'name', :order_index => 1, :sort_direction => 'ASC') - @filter.columns.build(:family => 'metric', :kee => 'ncloc', :order_index => 2, :variation => @filter.default_period?) - @filter.columns.build(:family => 'metric', :kee => 'violations_density', :order_index => 3, :variation => @filter.default_period?) + @filter.columns.build(:family => 'metric', :kee => 'ncloc', :order_index => 2, :variation => @filter.period?) + @filter.columns.build(:family => 'metric', :kee => 'violations_density', :order_index => 3, :variation => @filter.period?) @filter.columns.build(:family => 'date', :order_index => 4) column_index=0 @@ -408,7 +408,7 @@ class FiltersController < ApplicationController @width=(params[:width]||'800').to_i @height=(params[:height]||'500').to_i - treemap_options={:variation_index => @filter_context.variation_index} + treemap_options={:period_index => @filter_context.period_index} @treemap=Sonar::Treemap.new(@filter_context.measures_by_snapshot, @width, @height, @size_metric, @color_metric, treemap_options) render :action => "treemap", :layout => false end @@ -428,7 +428,7 @@ class FiltersController < ApplicationController filter.favourites=params[:favourites].present? filter.resource_id=(params[:path_id].present? ? Project.by_key(params[:path_id]).id : nil) filter.user_id=current_user.id - filter.variation_index=params[:variation_index].to_i + filter.period_index=params[:period_index].to_i filter.criteria=[] filter.criteria< 'date', :operator => params['date_operator'], :value => params['date_value']) if params['date_operator'].present? @@ -484,7 +484,7 @@ class FiltersController < ApplicationController end @filter=nil - @variation_index=params[:var].to_i + @period_index=params[:period].to_i if @active @filter=@active.filter unless @filter.ajax_loading? diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb index d240996c7c0..242be6bc1f5 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb @@ -440,8 +440,8 @@ module ApplicationHelper end index=options[:index] - if index.nil? && defined?(@dashboard_configuration) && @dashboard_configuration.variation? - index = @dashboard_configuration.variation_index + if index.nil? && defined?(@dashboard_configuration) && @dashboard_configuration.selected_period? + index = @dashboard_configuration.period_index end m.variation(index) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb index 0cebecfe02a..f49827b46cb 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/dashboard_helper.rb @@ -28,7 +28,7 @@ module DashboardHelper @snapshot.measure(metric_key) end - def variation_select_option(snapshot, index) + def period_select_options(snapshot, index) return nil if snapshot.nil? || snapshot.project_snapshot.nil? mode=snapshot.project_snapshot.send "period#{index}_mode" mode_param=snapshot.project_snapshot.send "period#{index}_param" @@ -44,7 +44,7 @@ module DashboardHelper label = "Compare to #{localize(Date.parse(mode_param))}" end if label - selected=(params[:var]==index.to_s ? 'selected' : '') + selected=(params[:period]==index.to_s ? 'selected' : '') "" end else diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/drilldown_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/drilldown_helper.rb index 1959e5709ae..0016d5e7919 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/drilldown_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/drilldown_helper.rb @@ -19,7 +19,7 @@ # module DrilldownHelper - def variation_select_option(snapshot, index) + def period_select_options(snapshot, index) return nil if snapshot.nil? || snapshot.project_snapshot.nil? mode=snapshot.project_snapshot.send "period#{index}_mode" mode_param=snapshot.project_snapshot.send "period#{index}_param" @@ -35,7 +35,7 @@ module DrilldownHelper label = "New violations since #{localize(Date.parse(mode_param))}" end if label - selected=(params[:var]==index.to_s ? 'selected' : '') + selected=(params[:period]==index.to_s ? 'selected' : '') "" end else @@ -46,7 +46,7 @@ module DrilldownHelper def measure_or_variation_value(measure) if measure - @variation_index ? measure.variation(@variation_index) : measure.value + @period_index ? measure.variation(@period_index) : measure.value else nil end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/filters_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/filters_helper.rb index 159341710d1..b6a2b77c04b 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/filters_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/filters_helper.rb @@ -98,7 +98,7 @@ module FiltersHelper #----- VARIATION - java_filter.setSortedVariationIndex(filter_context.variation_index) + java_filter.setSortedVariationIndex(filter_context.period_index) #----- EXECUTION java_result=java_facade.execute_filter(java_filter) @@ -160,9 +160,9 @@ module FiltersHelper end def period_names - p1=Property.value('sonar.timemachine.variation1', nil, 'previous_analysis') - p2=Property.value('sonar.timemachine.variation2', nil, '5') - p3=Property.value('sonar.timemachine.variation3', nil, '30') + p1=Property.value('sonar.timemachine.period1', nil, 'previous_analysis') + p2=Property.value('sonar.timemachine.period2', nil, '5') + p3=Property.value('sonar.timemachine.period3', nil, '30') [period_name(p1), period_name(p2), period_name(p3)] end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/api/dashboard_configuration.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/api/dashboard_configuration.rb index 8e7bd6c4d7b..623c92856d9 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/api/dashboard_configuration.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/api/dashboard_configuration.rb @@ -19,12 +19,12 @@ # class Api::DashboardConfiguration - attr_accessor :dashboard, :variation_index, :variation + attr_accessor :dashboard, :period_index, :selected_period def initialize(dashboard, options={}) @dashboard=dashboard - @variation_index=options[:variation_index].to_i - @variation=(@variation_index>0) + @period_index=options[:period_index].to_i + @selected_period=(@period_index>0) end def name @@ -43,8 +43,8 @@ class Api::DashboardConfiguration @dashboard.number_of_columns end - def variation? - @variation + def selected_period? + @selected_period end end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/drilldown.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/drilldown.rb index d424ce3ccc7..7f916b07d1a 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/drilldown.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/drilldown.rb @@ -45,7 +45,7 @@ class DrilldownColumn @scope=scope @snapshot = snapshot - value_column = (options[:variation_index] ? "variation_value_#{options[:variation_index]}" : 'value') + value_column = (options[:period_index] ? "variation_value_#{options[:period_index]}" : 'value') order="project_measures.#{value_column}" if metric.direction<0 order += ' DESC' diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/filter.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/filter.rb index 1809b9c7d43..3cf5c83907f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/filter.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/filter.rb @@ -125,20 +125,20 @@ class Filter < ActiveRecord::Base def advanced_search? @advanced_search ||= begin - !(criterion('language').nil?) || favourites || !(criterion('name').nil?) || !(criterion('key').nil?) || !(criterion('date').nil?) || default_period? + !(criterion('language').nil?) || favourites || !(criterion('name').nil?) || !(criterion('key').nil?) || !(criterion('date').nil?) || period? end end - def variation_index=(vi) + def period_index=(vi) if vi && vi>0 - write_attribute(:variation_index, vi) + write_attribute(:period_index, vi) else - write_attribute(:variation_index, nil) + write_attribute(:period_index, nil) end end - def default_period? - variation_index && variation_index>0 + def period? + period_index && period_index>0 end protected diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/filter_context.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/filter_context.rb index 1503cabb4ad..3145b1c26f3 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/filter_context.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/filter_context.rb @@ -18,7 +18,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 # class FilterContext - attr_accessor :filter, :page_size, :page_id, :security_exclusions, :variation_index, :user, :sorted_column_id, :ascending_sort + attr_accessor :filter, :page_size, :page_id, :security_exclusions, :period_index, :user, :sorted_column_id, :ascending_sort def initialize(filter, options={}) @filter = filter @@ -27,7 +27,7 @@ @sorted_column_id=(options[:sort].blank? ? nil : options[:sort].to_i) @ascending_sort=(options[:asc].blank? ? nil : options[:asc]=='true') @user=options[:user] - @variation_index = (options[:var] ? options[:var].to_i : @filter.variation_index ) + @period_index = (options[:period] ? options[:period].to_i : @filter.period_index ) @metric_ids=(options[:metric_ids] || @filter.columns.map{|col| col.metric ? col.metric.id : nil}.compact.uniq) end @@ -132,8 +132,8 @@ @security_exclusions==true end - def variation? - @variation_index && @variation_index>0 + def selected_period? + @period_index && @period_index>0 end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/measure_color.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/measure_color.rb index 4f8afc58f65..d7971393cf6 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/measure_color.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/measure_color.rb @@ -28,7 +28,7 @@ class MeasureColor # Options : # * min : min value, else the metric worst_value # * max : max value, else the metric best_value - # * variation_index: integer between 1 and 5 if set, else nil + # * period_index: integer between 1 and 5 if set, else nil # * check_alert_status: true|false. Default is true. # def self.color(measure, options={}) @@ -38,9 +38,9 @@ class MeasureColor min_value = options[:min] || measure.metric.worst_value percent=-1.0 - if options[:variation_index] + if options[:period_index] if min_value && max_value - value=measure.variation(options[:variation_index]) + value=measure.variation(options[:period_index]) percent = value_to_percent(value, min_value, max_value) end else diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb index 5c45f336390..0089401ff7c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/project_measure.rb @@ -110,9 +110,9 @@ class ProjectMeasure < ActiveRecord::Base end end - def variation(variation_index) + def variation(period_index) result = nil - case variation_index + case period_index when 1 result=variation_value_1 when 2 diff --git a/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap.rb b/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap.rb index a7b6c931adb..cb9d2bfaa55 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/models/sonar/treemap.rb @@ -29,8 +29,8 @@ class Sonar::Treemap @width = width @height = height - if options[:variation_index] && options[:variation_index]>0 - @variation_index = options[:variation_index] + if options[:period_index] && options[:period_index]>0 + @period_index = options[:period_index] end end @@ -91,8 +91,8 @@ class Sonar::Treemap end def size_value(measure) - if @variation_index - var=measure.variation(@variation_index) + if @period_index + var=measure.variation(@period_index) var ? var.to_f.abs : 0.0 elsif measure.value measure.value.to_f.abs||0.0 diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb index 2753b7b92f7..958fb837c7b 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/dashboard/_header.html.erb @@ -16,28 +16,21 @@ <% if @snapshot %>

- <% - profile_measure=@snapshot.measure(Metric::PROFILE) - %> <%= link_to_favourite(@project) -%> Version <%= @snapshot.version -%> - <%= l @snapshot.created_at %> - <% if profile_measure %> - Profile <%= link_to profile_measure.data, :controller => '/rules_configuration', :action => 'index', :id => profile_measure.value.to_i %><% end %> <% if @snapshot.project_snapshot.periods? %> - -
- - <%= variation_select_option(@snapshot, 1) -%> - <%= variation_select_option(@snapshot, 2) -%> - <%= variation_select_option(@snapshot, 3) -%> - <%= variation_select_option(@snapshot, 4) -%> - <%= variation_select_option(@snapshot, 5) -%> + <%= period_select_options(@snapshot, 1) -%> + <%= period_select_options(@snapshot, 2) -%> + <%= period_select_options(@snapshot, 3) -%> + <%= period_select_options(@snapshot, 4) -%> + <%= period_select_options(@snapshot, 5) -%>
<% end %>

<% end %> - - - - + \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_rule_priority.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_rule_priority.erb index c6e52fd8faa..e9e85333357 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_rule_priority.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/_rule_priority.erb @@ -1,8 +1,8 @@ <%= image_tag "priority/#{priority_id}.png" %> - <%= link_to label, {:controller => 'drilldown', :action => 'violations', :id => @project.id, :priority => Sonar::RulePriority.to_s(priority_id), :var => @variation_index} %> + <%= link_to label, {:controller => 'drilldown', :action => 'violations', :id => @project.id, :priority => Sonar::RulePriority.to_s(priority_id), :period => @period_index} %> - <%= @variation_index ? format_variation(measure, :index => @variation_index) : format_measure(measure) -%> + <%= @period_index ? format_variation(measure, :index => @period_index) : format_measure(measure) -%> <% value = measure_or_variation_value(measure) %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb index 84dd2eef2ff..131eb5227ee 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/drilldown/violations.html.erb @@ -6,14 +6,14 @@ <%= link_to_favourite(@project) -%> Version <%= @snapshot.version -%> - <%= l @snapshot.created_at %> <% if profile_measure %> - Profile <%= link_to profile_measure.data, :controller => '/rules_configuration', :action => 'index', :id => profile_measure.value.to_i %><% end %> <% if @snapshot.project_snapshot.periods? %> --
- - <%= variation_select_option(@snapshot, 1) -%> - <%= variation_select_option(@snapshot, 2) -%> - <%= variation_select_option(@snapshot, 3) -%> - <%= variation_select_option(@snapshot, 4) -%> - <%= variation_select_option(@snapshot, 5) -%> + <%= period_select_options(@snapshot, 1) -%> + <%= period_select_options(@snapshot, 2) -%> + <%= period_select_options(@snapshot, 3) -%> + <%= period_select_options(@snapshot, 4) -%> + <%= period_select_options(@snapshot, 5) -%>
<% end %> @@ -28,9 +28,9 @@ <% - value_column = (@variation_index ? "variation_value_#{@variation_index}" : 'value') + value_column = (@period_index ? "variation_value_#{@period_index}" : 'value') max = 0 - if @variation_index + if @period_index blocker_violations=@snapshot.measure('new_blocker_violations') critical_violations=@snapshot.measure('new_critical_violations') major_violations=@snapshot.measure('new_major_violations') @@ -63,7 +63,7 @@
<% - if @variation_index + if @period_index rule_measures=@snapshot.rule_measures(Metric.by_key('new_violations'), @priority_id) else rule_measures=@snapshot.rule_measures(Metric.by_key('violations'), @priority_id) @@ -103,7 +103,7 @@ <%= link_to(rule.name, {:overwrite_params => {:rule => rule.key, :sid => nil, :priority => Sonar::RulePriority.to_s(@priority_id)}}, :title => "#{rule.plugin_name}: #{rule.plugin_rule_key}") %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb index d6016ab67d6..f608d3a7da9 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/_list.html.erb @@ -1,11 +1,11 @@ <% filter=@filter_context.filter %>
Period: -
- <% period_names.each_with_index do |name, index| %> -
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/treemap.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/treemap.html.erb index 4fa5b299e59..5c881d2f96e 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/filters/treemap.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/filters/treemap.html.erb @@ -19,10 +19,10 @@ diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/168_add_periods_to_filters.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/168_add_periods_to_filters.rb new file mode 100644 index 00000000000..23be6b35b04 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/168_add_periods_to_filters.rb @@ -0,0 +1,37 @@ +# +# Sonar, entreprise quality control tool. +# Copyright (C) 2009 SonarSource SA +# mailto:contact AT sonarsource DOT com +# +# Sonar is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# Sonar is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with Sonar; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 +# + +# +# Sonar 2.5 +# +class AddPeriodsToFilters < ActiveRecord::Migration + + def self.up + add_column :filters, :period_index, :integer, :null => true + Filter.reset_column_information + + add_column :filter_columns, :variation, :boolean, :null => true + FilterColumn.reset_column_information + + add_column :criteria, :variation, :boolean, :null => true + Criterion.reset_column_information + end + +end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/168_add_variations_to_filters.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/168_add_variations_to_filters.rb deleted file mode 100644 index 905407fad79..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/168_add_variations_to_filters.rb +++ /dev/null @@ -1,37 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2009 SonarSource SA -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# - -# -# Sonar 2.5 -# -class AddVariationsToFilters < ActiveRecord::Migration - - def self.up - add_column :filters, :variation_index, :integer, :null => true - Filter.reset_column_information - - add_column :filter_columns, :variation, :boolean, :null => true - FilterColumn.reset_column_information - - add_column :criteria, :variation, :boolean, :null => true - Criterion.reset_column_information - end - -end diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Measure.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Measure.java index ca9d1879206..7679100cd56 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Measure.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Measure.java @@ -44,6 +44,8 @@ public class Measure extends Model { */ private String ruleCategory; + private Double variation1, variation2, variation3, variation4, variation5; + public String getMetricKey() { return metricKey; } @@ -223,6 +225,86 @@ public class Measure extends Model { return this; } + /** + * Variation value on period 1. The value is loaded if ResourceQuery#setIncludeTrends() is set to true. + * @since 2.5 + */ + public Double getVariation1() { + return variation1; + } + + /** + * @since 2.5 + */ + public Measure setVariation1(Double variation1) { + this.variation1 = variation1; + return this; + } + + /** + * Variation value on period 2. The value is loaded if ResourceQuery#setIncludeTrends() is set to true. + * @since 2.5 + */ + public Double getVariation2() { + return variation2; + } + + /** + * @since 2.5 + */ + public Measure setVariation2(Double variation2) { + this.variation2 = variation2; + return this; + } + + /** + * Variation value on period 3. The value is loaded if ResourceQuery#setIncludeTrends() is set to true. + * @since 2.5 + */ + public Double getVariation3() { + return variation3; + } + + /** + * @since 2.5 + */ + public Measure setVariation3(Double variation3) { + this.variation3 = variation3; + return this; + } + + /** + * Variation value on period 4. The value is loaded if ResourceQuery#setIncludeTrends() is set to true. + * @since 2.5 + */ + public Double getVariation4() { + return variation4; + } + + /** + * @since 2.5 + */ + public Measure setVariation4(Double variation4) { + this.variation4 = variation4; + return this; + } + + /** + * Variation value on period 5. The value is loaded if ResourceQuery#setIncludeTrends() is set to true. + * @since 2.5 + */ + public Double getVariation5() { + return variation5; + } + + /** + * @since 2.5 + */ + public Measure setVariation5(Double variation5) { + this.variation5 = variation5; + return this; + } + @Override public String toString() { return new StringBuilder().append("Measure{") diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Resource.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Resource.java index 27f6ba6b209..6df1d4d744b 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Resource.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Resource.java @@ -29,7 +29,7 @@ public class Resource extends Model { public static final String SCOPE_SET = "PRJ"; public static final String SCOPE_SPACE = "DIR"; public static final String SCOPE_ENTITY = "FIL"; - + /* QUALIFIERS */ public static final String QUALIFIER_VIEW = "VW"; public static final String QUALIFIER_SUBVIEW = "SVW"; @@ -58,6 +58,11 @@ public class Resource extends Model { private Date date; private List measures; + // periods used for variations and tracking of violations + private String period1Mode, period2Mode, period3Mode, period4Mode, period5Mode; + private String period1Param, period2Param, period3Param, period4Param, period5Param; + private Date period1Date, period2Date, period3Date, period4Date, period5Date; + public Integer getId() { return id; } @@ -208,6 +213,231 @@ public class Resource extends Model { this.measures = measures; } + /** + * @since 2.5 only on projects, else null + */ + public String getPeriod1Mode() { + return period1Mode; + } + + /** + * @since 2.5 + */ + public Resource setPeriod1Mode(String period1Mode) { + this.period1Mode = period1Mode; + return this; + } + + /** + * @since 2.5 only on projects, else null + */ + public String getPeriod2Mode() { + return period2Mode; + } + + /** + * @since 2.5 + */ + public Resource setPeriod2Mode(String period2Mode) { + this.period2Mode = period2Mode; + return this; + } + + /** + * @since 2.5 only on projects, else null + */ + public String getPeriod3Mode() { + return period3Mode; + } + + /** + * @since 2.5 + */ + public Resource setPeriod3Mode(String period3Mode) { + this.period3Mode = period3Mode; + return this; + } + + /** + * @since 2.5 only on projects, else null + */ + public String getPeriod4Mode() { + return period4Mode; + } + + /** + * @since 2.5 + */ + public Resource setPeriod4Mode(String period4Mode) { + this.period4Mode = period4Mode; + return this; + } + + /** + * @since 2.5 only on projects, else null + */ + public String getPeriod5Mode() { + return period5Mode; + } + + /** + * @since 2.5 + */ + public Resource setPeriod5Mode(String period5Mode) { + this.period5Mode = period5Mode; + return this; + } + + /** + * @since 2.5 only on projects, else null + */ + public String getPeriod1Param() { + return period1Param; + } + + /** + * @since 2.5 + */ + public Resource setPeriod1Param(String period1Param) { + this.period1Param = period1Param; + return this; + } + + /** + * @since 2.5 only on projects, else null + */ + public String getPeriod2Param() { + return period2Param; + } + + /** + * @since 2.5 + */ + public Resource setPeriod2Param(String period2Param) { + this.period2Param = period2Param; + return this; + } + + /** + * @since 2.5 only on projects, else null + */ + public String getPeriod3Param() { + return period3Param; + } + + /** + * @since 2.5 + */ + public Resource setPeriod3Param(String period3Param) { + this.period3Param = period3Param; + return this; + } + + /** + * @since 2.5 only on projects, else null + */ + public String getPeriod4Param() { + return period4Param; + } + + /** + * @since 2.5 + */ + public Resource setPeriod4Param(String period4Param) { + this.period4Param = period4Param; + return this; + } + + /** + * @since 2.5 only on projects, else null + */ + public String getPeriod5Param() { + return period5Param; + } + + /** + * @since 2.5 + */ + public Resource setPeriod5Param(String period5Param) { + this.period5Param = period5Param; + return this; + } + + /** + * @since 2.5 only on projects, else null + */ + public Date getPeriod1Date() { + return period1Date; + } + + /** + * @since 2.5 + */ + public Resource setPeriod1Date(Date period1Date) { + this.period1Date = period1Date; + return this; + } + + /** + * @since 2.5 only on projects, else null + */ + public Date getPeriod2Date() { + return period2Date; + } + + /** + * @since 2.5 + */ + public Resource setPeriod2Date(Date period2Date) { + this.period2Date = period2Date; + return this; + } + + /** + * @since 2.5 only on projects, else null + */ + public Date getPeriod3Date() { + return period3Date; + } + + /** + * @since 2.5 + */ + public Resource setPeriod3Date(Date period3Date) { + this.period3Date = period3Date; + return this; + } + + /** + * @since 2.5 only on projects, else null + */ + public Date getPeriod4Date() { + return period4Date; + } + + /** + * @since 2.5 + */ + public Resource setPeriod4Date(Date period4Date) { + this.period4Date = period4Date; + return this; + } + + /** + * @since 2.5 only on projects, else null + */ + public Date getPeriod5Date() { + return period5Date; + } + + /** + * @since 2.5 + */ + public Resource setPeriod5Date(Date period5Date) { + this.period5Date = period5Date; + return this; + } + @Override public String toString() { return new StringBuilder() diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ResourceUnmarshaller.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ResourceUnmarshaller.java index 81b86cd8b12..fba424d4bbe 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ResourceUnmarshaller.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/ResourceUnmarshaller.java @@ -47,7 +47,22 @@ public class ResourceUnmarshaller extends AbstractUnmarshaller { .setLanguage(JsonUtils.getString(json, "lang")) .setDescription(JsonUtils.getString(json, "description")) .setDate(JsonUtils.getDateTime(json, "date")) - .setVersion(JsonUtils.getString(json, "version")); + .setVersion(JsonUtils.getString(json, "version")) + .setPeriod1Mode(JsonUtils.getString(json, "p1")) + .setPeriod1Param(JsonUtils.getString(json, "p1p")) + .setPeriod1Date(JsonUtils.getDateTime(json, "p1d")) + .setPeriod2Mode(JsonUtils.getString(json, "p2")) + .setPeriod2Param(JsonUtils.getString(json, "p2p")) + .setPeriod2Date(JsonUtils.getDateTime(json, "p2d")) + .setPeriod3Mode(JsonUtils.getString(json, "p3")) + .setPeriod3Param(JsonUtils.getString(json, "p3p")) + .setPeriod3Date(JsonUtils.getDateTime(json, "p3d")) + .setPeriod4Mode(JsonUtils.getString(json, "p4")) + .setPeriod4Param(JsonUtils.getString(json, "p4p")) + .setPeriod4Date(JsonUtils.getDateTime(json, "p4d")) + .setPeriod5Mode(JsonUtils.getString(json, "p5")) + .setPeriod5Param(JsonUtils.getString(json, "p5p")) + .setPeriod5Date(JsonUtils.getDateTime(json, "p5d")); } private void parseMeasures(JSONObject json, Resource resource) { @@ -85,7 +100,12 @@ public class ResourceUnmarshaller extends AbstractUnmarshaller { .setRuleCategory(JsonUtils.getString(json, "rule_category")) .setRuleSeverity(JsonUtils.getString(json, "rule_priority")) .setCharacteristicKey(JsonUtils.getString(json, "ctic_key")) - .setCharacteristicName(JsonUtils.getString(json, "ctic_name")); + .setCharacteristicName(JsonUtils.getString(json, "ctic_name")) + .setVariation1(JsonUtils.getDouble(json, "var1")) + .setVariation2(JsonUtils.getDouble(json, "var2")) + .setVariation3(JsonUtils.getDouble(json, "var3")) + .setVariation4(JsonUtils.getDouble(json, "var4")) + .setVariation5(JsonUtils.getDouble(json, "var5")); return measure; } } diff --git a/tests/integration/tests/custom-projects/violations-timemachine/v2/src/main/java/org/sonar/tests/violationstimemachine/SecondFileAddedInV2.java b/tests/integration/tests/custom-projects/violations-timemachine/v2/src/main/java/org/sonar/tests/violationstimemachine/SecondFileAddedInV2.java new file mode 100644 index 00000000000..bddd7f0c346 --- /dev/null +++ b/tests/integration/tests/custom-projects/violations-timemachine/v2/src/main/java/org/sonar/tests/violationstimemachine/SecondFileAddedInV2.java @@ -0,0 +1,10 @@ +package org.sonar.tests.violationstimemachine; + +public class SecondFileAddedInV2 { + + public void hasOneViolation() { + int i = 0; // unused local variable + i++; + } + +} diff --git a/tests/integration/tests/src/test/java/org/sonar/tests/integration/VariationsIT.java b/tests/integration/tests/src/test/java/org/sonar/tests/integration/VariationsIT.java index 20307d6367a..e794306ddad 100644 --- a/tests/integration/tests/src/test/java/org/sonar/tests/integration/VariationsIT.java +++ b/tests/integration/tests/src/test/java/org/sonar/tests/integration/VariationsIT.java @@ -19,5 +19,45 @@ */ package org.sonar.tests.integration; +import org.junit.BeforeClass; +import org.junit.Test; +import org.sonar.wsclient.Sonar; +import org.sonar.wsclient.services.Resource; +import org.sonar.wsclient.services.ResourceQuery; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.number.OrderingComparisons.greaterThan; +import static org.junit.Assert.assertThat; + public class VariationsIT { + + private static final String TIMEMACHINE_PROJECT = "org.sonar.tests:violations-timemachine"; + + private static Sonar sonar; + + @BeforeClass + public static void buildServer() { + sonar = ITUtils.createSonarWsClient(); + } + + @Test + public void checkBaseVariations() { + + Resource project = getProject("files", "ncloc", "violations"); + + // period 1 : previous analysis + assertThat(project.getPeriod1Mode(), is("previous_analysis")); + assertThat(project.getPeriod1Date(), notNullValue()); + + // variations from previous analysis + assertThat(project.getMeasure("files").getVariation1(), is(1.0)); + assertThat(project.getMeasure("ncloc").getVariation1(), is(8.0)); + assertThat(project.getMeasure("violations").getVariation1(), greaterThan(0.0)); + } + + private Resource getProject(String... metricKeys) { + return sonar.find(ResourceQuery.createForMetrics(TIMEMACHINE_PROJECT, metricKeys).setIncludeTrends(true)); + } + } diff --git a/tests/integration/tests/src/test/java/org/sonar/tests/integration/ViolationsTimeMachineIT.java b/tests/integration/tests/src/test/java/org/sonar/tests/integration/ViolationsTimeMachineIT.java index 14d2774abf7..f3b07ef6d6c 100644 --- a/tests/integration/tests/src/test/java/org/sonar/tests/integration/ViolationsTimeMachineIT.java +++ b/tests/integration/tests/src/test/java/org/sonar/tests/integration/ViolationsTimeMachineIT.java @@ -48,7 +48,7 @@ public class ViolationsTimeMachineIT { assertThat(snapshot1.getValues(), is(Arrays.asList("0.0", "0.0", "3.0", "4.0", "0.0"))); assertThat(snapshot2.getDate().getMonth(), is(10)); - assertThat(snapshot2.getValues(), is(Arrays.asList("0.0", "0.0", "4.0", "3.0", "0.0"))); + assertThat(snapshot2.getValues(), is(Arrays.asList("0.0", "0.0", "5.0", "4.0", "0.0"))); } @Test
- <%= @variation_index ? format_variation(rule_measure, :index => @variation_index) : rule_measure.formatted_value -%> + <%= @period_index ? format_variation(rule_measure, :index => @period_index) : rule_measure.formatted_value -%> <%= barchart(:width => 70, :percent => (100 * value / max).to_i, :color => '#777') if max>0 %> @@ -158,7 +158,7 @@ <% end %> - <%= @variation_index ? format_variation(measure, :index => @variation_index) : measure.formatted_value -%> + <%= @period_index ? format_variation(measure, :index => @period_index) : measure.formatted_value -%>
Default period: - <% period_names.each_with_index do |name, index| %> - Period:
- <% period_names.each_with_index do |name, index| %> -