diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-05-28 11:52:22 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-05-28 11:52:22 +0200 |
commit | b0b85a7d8ef0795af580fca3c8a13f612d9332df (patch) | |
tree | d12adfce9aaaf539c24afb35b71e5a524717526c /sonar-server | |
parent | 5cf8a8864fb93e090a07b3382dfbb9f5053bce26 (diff) | |
download | sonarqube-b0b85a7d8ef0795af580fca3c8a13f612d9332df.tar.gz sonarqube-b0b85a7d8ef0795af580fca3c8a13f612d9332df.zip |
SONAR-3755 Removed useless ruby templates used to display violations
Diffstat (limited to 'sonar-server')
5 files changed, 45 insertions, 291 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_issues.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_issues.html.erb index 3165fd0d280..aa1c5835e63 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_issues.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_header_issues.html.erb @@ -64,7 +64,7 @@ </table> <% end %> - <%= render :partial => 'options_issues' -%> + <%= render :partial => 'options' -%> </div> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb index 638b6e94ad0..f7634397f99 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb @@ -1,4 +1,4 @@ -<% display_options = @scm_available || @expandable || @filtered || @display_violations +<% display_options = @scm_available || @expandable || @filtered || @display_issues if display_options %> @@ -29,7 +29,7 @@ <% first=false end %> - <% if @scm_available && !@display_violations && @snapshot.project_snapshot.periods? %> + <% if @scm_available && !@display_issues && @snapshot.project_snapshot.periods? %> <td class="<%= 'first' if first -%>"> <select name="period" class="period" onchange="applyOptions(this)"> <option value=""><%= message('time_changes') -%>...</option> @@ -44,7 +44,7 @@ first=false end %> - <% if @display_violations %> + <% if @display_issues %> <td class="<%= 'first' if first -%>"> <select name="period" class="period" onchange="applyOptions(this)"> <option value=""><%= message('time_changes') -%>...</option> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options_issues.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options_issues.html.erb deleted file mode 100644 index 8713a75e997..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options_issues.html.erb +++ /dev/null @@ -1,117 +0,0 @@ -<% display_options = @scm_available || @expandable || @filtered || @display_issues - if display_options -%> - - <div class="source_options"> - <script> - applyOptions = function (elt) { - var currentForm = $j(elt).closest('.options-form'); - var params = currentForm.serialize(); - var url = '<%= ApplicationController.root_context -%>/resource/index/<%= @resource.key %>?display_title=<%= params[:display_title].to_s -%>&'+ params; - openAccordionItem(url, elt, true); - return true; - }; - </script> - <form method="GET" action="<%= url_for :controller => 'resource', :action => 'index', :id => @resource.key -%>" class="options-form"> - <input type="hidden" name="tab" value="<%= params[:tab] -%>"/> - <input type="hidden" name="metric" value="<%= params[:metric] -%>"/> - <input type="hidden" name="period" value="<%= params[:period] -%>"/> - - <table> - <tr> - <% - first=true - if @expandable %> - <td class="<%= 'first' if first -%>"> - <input type="checkbox" value="true" name="expand" <%= 'checked' if @expanded -%> onclick="applyOptions(this)"/> - <label for="expand"><%= message('full_source') -%></label> - </td> - <% first=false - end %> - - <% if @scm_available && !@display_issues && @snapshot.project_snapshot.periods? %> - <td class="<%= 'first' if first -%>"> - <select name="period" class="period" onchange="applyOptions(this)"> - <option value=""><%= message('time_changes') -%>...</option> - <%= 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) -%> - </select> - </td> - <% - first=false - end %> - - <% if @display_issues %> - <td class="<%= 'first' if first -%>"> - <select name="period" class="period" onchange="applyOptions(this)"> - <option value=""><%= message('time_changes') -%>...</option> - <%= violation_period_select_options(@snapshot, 1) -%> - <%= violation_period_select_options(@snapshot, 2) -%> - <%= violation_period_select_options(@snapshot, 3) -%> - <%= violation_period_select_options(@snapshot, 4) -%> - <%= violation_period_select_options(@snapshot, 5) -%> - </select> - </td> - - <td class="<%= 'first' if first -%>"><%= render :partial => 'rules_filter_issues' -%></td> - <% first=false - end %> - - <% if @display_coverage %> - <td class="<%= 'first' if first -%>"> - <select class="coverage_filter" name="coverage_filter" onchange="applyOptions(this)"> - <optgroup label="<%= h message('coverage_viewer.unit_tests') -%>"> - <option value="lines_to_cover" <%= 'selected' if @coverage_filter=='lines_to_cover' -%>><%= Metric.name_for('lines_to_cover') -%></option> - <option value="uncovered_lines" <%= 'selected' if @coverage_filter=='uncovered_lines' -%>><%= Metric.name_for('uncovered_lines') -%></option> - <option value="conditions_to_cover" <%= 'selected' if @coverage_filter=='conditions_to_cover' -%>><%= Metric.name_for('conditions_to_cover') -%></option> - <option value="uncovered_conditions" <%= 'selected' if @coverage_filter=='uncovered_conditions' -%>><%= Metric.name_for('uncovered_conditions') -%></option> - </optgroup> - <% if @display_it_coverage %> - <optgroup label="<%= h message('coverage_viewer.integration_tests') -%>"> - <option value="it_lines_to_cover" <%= 'selected' if @coverage_filter=='it_lines_to_cover' -%>><%= Metric.name_for('it_lines_to_cover') -%></option> - <option value="it_uncovered_lines" <%= 'selected' if @coverage_filter=='it_uncovered_lines' -%>><%= Metric.name_for('it_uncovered_lines') -%></option> - <option value="it_conditions_to_cover" <%= 'selected' if @coverage_filter=='it_conditions_to_cover' -%>><%= Metric.name_for('it_conditions_to_cover') -%></option> - <option value="it_uncovered_conditions" <%= 'selected' if @coverage_filter=='it_uncovered_conditions' -%>><%= Metric.name_for('it_uncovered_conditions') -%></option> - </optgroup> - <% end %> - <% if @display_overall_coverage %> - <optgroup label="<%= h message('coverage_viewer.overall_tests') -%>"> - <option value="overall_lines_to_cover" <%= 'selected' if @coverage_filter=='overall_lines_to_cover' -%>><%= Metric.name_for('overall_lines_to_cover') -%></option> - <option value="overall_uncovered_lines" <%= 'selected' if @coverage_filter=='overall_uncovered_lines' -%>><%= Metric.name_for('overall_uncovered_lines') -%></option> - <option value="overall_conditions_to_cover" <%= 'selected' if @coverage_filter=='overall_conditions_to_cover' -%>><%= Metric.name_for('overall_conditions_to_cover') -%></option> - <option value="overall_uncovered_conditions" <%= 'selected' if @coverage_filter=='overall_uncovered_conditions' -%>><%= Metric.name_for('overall_uncovered_conditions') -%></option> - </optgroup> - <% end %> - <% if @testable && !@testable.testCases.empty? %> - <optgroup label="<%= h message('coverage_viewer.per_test') -%>"> - <option value="lines_covered_per_test" <%= 'selected' if @coverage_filter=='lines_covered_per_test' -%>><%= message('coverage_viewer.lines_covered_per_test') -%></option> - </optgroup> - <% end %> - </select> - </td> - - <% if @coverage_filter=='lines_covered_per_test' %> - <td class="<%= 'first' if first -%>"> - <select class="test_case_filter" name="test_case_filter" onchange="applyOptions(this)"> - <option value=""><%= message('coverage_viewer.select_test') -%></option> - <% @test_case_by_test_plan.sort_by{|test_plan, test_cases| test_plan.component.longName}.each do |test_plan, test_cases| %> - <optgroup label="<%= test_plan.component.longName %>"> - <% test_cases.sort_by{|test_case| test_case.name}.each do |test_case| %> - <option value="<%= test_case.name -%>" <%= 'selected' if @test_case_filter==test_case.name -%>><%= test_case.name -%></option> - <% end %> - </optgroup> - <% end %> - </select> - </td> - <% end %> - - <% first=false - end %> - </tr> - </table> - </form> - </div> -<% end %>
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_rules_filter.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_rules_filter.html.erb index a378c0d672f..8fcef107cb0 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_rules_filter.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_rules_filter.html.erb @@ -1,29 +1,29 @@ <% if @period - blocker_violations = @snapshot.measure('new_blocker_violations') - critical_violations = @snapshot.measure('new_critical_violations') - major_violations = @snapshot.measure('new_major_violations') - minor_violations = @snapshot.measure('new_minor_violations') - info_violations = @snapshot.measure('new_info_violations') + blocker_issues = @snapshot.measure('new_blocker_violations') + critical_issues = @snapshot.measure('new_critical_violations') + major_issues = @snapshot.measure('new_major_violations') + minor_issues = @snapshot.measure('new_minor_violations') + info_issues = @snapshot.measure('new_info_violations') metrics = [ - Metric.by_key("new_blocker_violations"), - Metric.by_key("new_critical_violations"), - Metric.by_key("new_major_violations"), - Metric.by_key("new_minor_violations"), - Metric.by_key("new_info_violations") + Metric.by_key('new_blocker_violations'), + Metric.by_key('new_critical_violations'), + Metric.by_key('new_major_violations'), + Metric.by_key('new_minor_violations'), + Metric.by_key('new_info_violations') ] else - blocker_violations = @snapshot.measure('blocker_violations') - critical_violations = @snapshot.measure('critical_violations') - major_violations = @snapshot.measure('major_violations') - minor_violations = @snapshot.measure('minor_violations') - info_violations = @snapshot.measure('info_violations') + blocker_issues = @snapshot.measure('blocker_violations') + critical_issues = @snapshot.measure('critical_violations') + major_issues = @snapshot.measure('major_violations') + minor_issues = @snapshot.measure('minor_violations') + info_issues = @snapshot.measure('info_violations') metrics = [ - Metric.by_key("blocker_violations"), - Metric.by_key("critical_violations"), - Metric.by_key("major_violations"), - Metric.by_key("minor_violations"), - Metric.by_key("info_violations") + Metric.by_key('blocker_violations'), + Metric.by_key('critical_violations'), + Metric.by_key('major_violations'), + Metric.by_key('minor_violations'), + Metric.by_key('info_violations') ] end @@ -44,77 +44,62 @@ <select name="rule" onchange="applyOptions(this)"> - <option value="all"><%= message('all_violations') -%></option> + <option value="all"><%= message('all_issues') -%></option> + + <option value="false_positive_issues" <%= 'selected' if params[:rule]=="false_positive_issues" -%>> + <%= message('issues_viewer.issue_filter.false_positives') -%> + </option> - <optgroup label="<%= message('reviews') -%>"> - <option value="false_positive_reviews" <%= 'selected' if params[:rule]=="false_positive_reviews" -%>> - <%= message('violations_viewer.review_filter.false_positives') -%> - </option> - <option value="active_reviews" <%= 'selected' if params[:rule]=="active_reviews" -%>> - <%= message('violations_viewer.review_filter.active') -%> - </option> - <option value="unassigned_reviews" <%= 'selected' if params[:rule]=="unassigned_reviews" -%>> - <%= message('violations_viewer.review_filter.unassigned') -%> - </option> - <option value="unplanned_reviews" <%= 'selected' if params[:rule]=="unplanned_reviews" -%>> - <%= message('violations_viewer.review_filter.unplanned') -%> - </option> - <option value="unreviewed_violations" <%= 'selected' if params[:rule]=="unreviewed_violations" -%>> - <%= message('violations_viewer.review_filter.unreviewed_violations') -%> - </option> - </optgroup> - - <optgroup label="<%= message('severity') -%>"> - <% if blocker_violations - value=(@period ? blocker_violations.variation(@period) : blocker_violations.value) + <% if blocker_issues + value=(@period ? blocker_issues.variation(@period) : blocker_issues.value) if value && value>0 %> <option value="<%= Sonar::RulePriority::BLOCKER.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::BLOCKER.to_s -%>><%= message('severity.BLOCKER') %> - (<%= blocker_violations.format_numeric_value(value) -%>) + (<%= blocker_issues.format_numeric_value(value) -%>) </option> <% end end %> - <% if critical_violations - value=(@period ? critical_violations.variation(@period) : critical_violations.value) + <% if critical_issues + value=(@period ? critical_issues.variation(@period) : critical_issues.value) if value && value>0 %> <option value="<%= Sonar::RulePriority::CRITICAL.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::CRITICAL.to_s -%>><%= message('severity.CRITICAL') %> - (<%= critical_violations.format_numeric_value(value) -%>) + (<%= critical_issues.format_numeric_value(value) -%>) </option> <% end end %> - <% if major_violations - value=(@period ? major_violations.variation(@period) : major_violations.value) + <% if major_issues + value=(@period ? major_issues.variation(@period) : major_issues.value) if value && value>0 %> <option value="<%= Sonar::RulePriority::MAJOR.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::MAJOR.to_s -%>><%= message('severity.MAJOR') %> - (<%= major_violations.format_numeric_value(value) -%>) + (<%= major_issues.format_numeric_value(value) -%>) </option> <% end end %> - <% if minor_violations - value=(@period ? minor_violations.variation(@period) : minor_violations.value) + <% if minor_issues + value=(@period ? minor_issues.variation(@period) : minor_issues.value) if value && value>0 %> <option value="<%= Sonar::RulePriority::MINOR.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::MINOR.to_s -%>><%= message('severity.MINOR') %> - (<%= minor_violations.format_numeric_value(value) -%>) + (<%= minor_issues.format_numeric_value(value) -%>) </option> <% end end %> - <% if info_violations - value=(@period ? info_violations.variation(@period) : info_violations.value) + <% if info_issues + value=(@period ? info_issues.variation(@period) : info_issues.value) if value && value>0 %> <option value="<%= Sonar::RulePriority::INFO.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::INFO.to_s -%>><%= message('severity.INFO') %> - (<%= info_violations.format_numeric_value(value) -%>) + (<%= info_issues.format_numeric_value(value) -%>) </option> <% end end @@ -125,5 +110,5 @@ <optgroup label="<%= message('rule') -%>"> <%= options_for_select(rule_options, params[:rule].to_i) -%> </optgroup> - + </select>
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_rules_filter_issues.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_rules_filter_issues.html.erb deleted file mode 100644 index 6996c61afd9..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_rules_filter_issues.html.erb +++ /dev/null @@ -1,114 +0,0 @@ -<% - if @period - blocker_issues = @snapshot.measure('new_blocker_violations') - critical_issues = @snapshot.measure('new_critical_violations') - major_issues = @snapshot.measure('new_major_violations') - minor_issues = @snapshot.measure('new_minor_violations') - info_issues = @snapshot.measure('new_info_violations') - metrics = [ - Metric.by_key('new_blocker_violations'), - Metric.by_key('new_critical_violations'), - Metric.by_key('new_major_violations'), - Metric.by_key('new_minor_violations'), - Metric.by_key('new_info_violations') - ] - else - blocker_issues = @snapshot.measure('blocker_violations') - critical_issues = @snapshot.measure('critical_violations') - major_issues = @snapshot.measure('major_violations') - minor_issues = @snapshot.measure('minor_violations') - info_issues = @snapshot.measure('info_violations') - metrics = [ - Metric.by_key('blocker_violations'), - Metric.by_key('critical_violations'), - Metric.by_key('major_violations'), - Metric.by_key('minor_violations'), - Metric.by_key('info_violations') - ] - end - - rule_counts=Hash.new(0) - @snapshot.rule_measures(metrics).each do |rule_measure| - count=(@period ? rule_measure.variation(@period) : rule_measure.value) - if count && count>0 - rule_counts[rule_measure.rule] += count.to_i - end - end - - rule_options=[] - rule_counts.keys.sort.each do |rule| - label = "#{rule.name} (#{rule_counts[rule]})" - rule_options<<[label, rule.id] - end -%> - -<select name="rule" onchange="applyOptions(this)"> - - <option value="all"><%= message('all_issues') -%></option> - - <option value="false_positive_issues" <%= 'selected' if params[:rule]=="false_positive_issues" -%>> - <%= message('issues_viewer.issue_filter.false_positives') -%> - </option> - - <optgroup label="<%= message('severity') -%>"> - <% if blocker_issues - value=(@period ? blocker_issues.variation(@period) : blocker_issues.value) - if value && value>0 - %> - <option value="<%= Sonar::RulePriority::BLOCKER.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::BLOCKER.to_s -%>><%= message('severity.BLOCKER') %> - (<%= blocker_issues.format_numeric_value(value) -%>) - </option> - <% end - end %> - - <% if critical_issues - value=(@period ? critical_issues.variation(@period) : critical_issues.value) - if value && value>0 - %> - <option value="<%= Sonar::RulePriority::CRITICAL.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::CRITICAL.to_s -%>><%= message('severity.CRITICAL') %> - (<%= critical_issues.format_numeric_value(value) -%>) - </option> - <% end - end - %> - - <% if major_issues - value=(@period ? major_issues.variation(@period) : major_issues.value) - if value && value>0 - %> - <option value="<%= Sonar::RulePriority::MAJOR.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::MAJOR.to_s -%>><%= message('severity.MAJOR') %> - (<%= major_issues.format_numeric_value(value) -%>) - </option> - <% end - end - %> - - <% if minor_issues - value=(@period ? minor_issues.variation(@period) : minor_issues.value) - if value && value>0 - %> - <option value="<%= Sonar::RulePriority::MINOR.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::MINOR.to_s -%>><%= message('severity.MINOR') %> - (<%= minor_issues.format_numeric_value(value) -%>) - </option> - <% end - end - %> - - <% if info_issues - value=(@period ? info_issues.variation(@period) : info_issues.value) - if value && value>0 - %> - <option value="<%= Sonar::RulePriority::INFO.to_s -%>" <%= 'selected' if params[:rule]==Sonar::RulePriority::INFO.to_s -%>><%= message('severity.INFO') %> - (<%= info_issues.format_numeric_value(value) -%>) - </option> - <% end - end - %> - </optgroup> - - - <optgroup label="<%= message('rule') -%>"> - <%= options_for_select(rule_options, params[:rule].to_i) -%> - </optgroup> - -</select>
\ No newline at end of file |