From bf85a1d7e322beb80725c603abc01af646575c0a Mon Sep 17 00:00:00 2001 From: simonbrandhof Date: Wed, 4 May 2011 11:16:38 +0200 Subject: [PATCH] Remove unused ruby code --- .../app/controllers/browse_controller.rb | 279 ------------------ .../views/browse/_header_coverage.html.erb | 41 --- .../app/views/browse/_header_source.html.erb | 139 --------- .../views/browse/_header_violations.html.erb | 48 --- .../app/views/browse/_options.html.erb | 65 ---- .../app/views/browse/_rules_filter.html.erb | 45 --- .../WEB-INF/app/views/browse/_tabs.html.erb | 37 --- .../app/views/browse/_violation.html.erb | 12 - .../app/views/browse/extension.html.erb | 23 -- .../WEB-INF/app/views/browse/index.html.erb | 103 ------- .../WEB-INF/app/views/browse/nothing.html.erb | 1 - 11 files changed, 793 deletions(-) delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/controllers/browse_controller.rb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_coverage.html.erb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_source.html.erb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_violations.html.erb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/browse/_options.html.erb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/browse/_rules_filter.html.erb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/browse/_tabs.html.erb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/browse/_violation.html.erb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/browse/extension.html.erb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/browse/index.html.erb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/browse/nothing.html.erb diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/browse_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/browse_controller.rb deleted file mode 100644 index 18809ca4221..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/browse_controller.rb +++ /dev/null @@ -1,279 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2011 SonarSource -# 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 -# -class BrowseController < ApplicationController - - SECTION=Navigation::SECTION_RESOURCE - helper DashboardHelper - - def index - @resource = Project.by_key(params[:id]) - - if (@resource && has_role?(:user, @resource)) - params[:layout]='false' - @snapshot=@resource.last_snapshot - - load_extensions() - - if @extension - if (@extension.getId()=='violations') - render_violations() - elsif (@extension.getId()=='coverage') - render_coverage() - elsif (@extension.getId()=='source') - render_source() - else - render_extension() - end - else - render_nothing() - end - else - access_denied - end - end - - private - - def load_extensions - @extensions=[] - java_facade.getResourceTabs(@resource.scope, @resource.qualifier, @resource.language).each do |tab| - tab.getUserRoles().each do |role| - if has_role?(role, @resource) - @extensions< 'index', :layout => !request.xhr? - end - - - - def render_violations - load_sources(false) - @display_violations=true - @global_violations=[] - @expandable=true - - conditions='snapshot_id=?' - values=[@snapshot.id] - unless params[:rule].blank? - severity=Sonar::RulePriority.id(params[:rule]) - if severity - conditions += ' AND failure_level=?' - values< 'rule', :conditions => [conditions] + values, :order => 'failure_level DESC').each do |violation| - # sorted by severity => from blocker to info - if violation.line && violation.line>0 && @lines - @lines[violation.line-1].add_violation(violation) - else - @global_violations<=0 && i<@lines.size - end - elsif line.hidden==nil - line.hidden=true - end - end - end - render :action => 'index', :layout => !request.xhr? - end - - - - - def render_source - load_sources(true) - filter_lines_by_date() - render :action => 'index', :layout => !request.xhr? - end - - - def filter_lines_by_date - if @period - date=@snapshot.period_datetime(@period) - if date - @lines.each do |line| - line.hidden=true if line.datetime==nil || line.datetime0 - end - - def violation_severity - if @violations && @violations.size>0 - @violations[0].failure_level - else - nil - end - end - - def date - @datetime ? @datetime.to_date : nil - end - - def deprecated_conditions_label=(label) - if label - @deprecated_conditions_label=label - if label=='0%' - @conditions=2 - @covered_conditions=0 - elsif label=='100%' - @conditions=2 - @covered_conditions=2 - else - @conditions=2 - @covered_conditions=1 - end - end - end - end - - - - - def render_extension() - render :action => 'extension', :layout => !request.xhr? - end - -def render_nothing() - render :action => 'nothing', :layout => !request.xhr? - end -end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_coverage.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_coverage.html.erb deleted file mode 100644 index 7590306ac0f..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_coverage.html.erb +++ /dev/null @@ -1,41 +0,0 @@ -
- - - - -
<%= format_measure('coverage', :default => '-') -%>
- - - <% if m=measure('line_coverage') %> - - - - - <% end %> - <% if m=measure('uncovered_lines') %> - - - - - <% end %> -
Line coverage:<%= format_measure(m) -%>
Uncovered lines:<%= format_measure(m) -%> / <%= format_measure('lines_to_cover') -%>
- - - <% if m=measure('branch_coverage') %> - - - - - <% end %> - <% if m=measure('uncovered_conditions') %> - - - - - <% end %> -
Branch coverage:<%= format_measure(m) -%>
Uncovered conditions:<%= format_measure(m) -%> / <%= format_measure('conditions_to_cover') -%>
- - <%= render :partial => 'options' -%> -
-
- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_source.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_source.html.erb deleted file mode 100644 index 2a4d1851f78..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_source.html.erb +++ /dev/null @@ -1,139 +0,0 @@ -
- - <% if m=measure('lines') %> - - - - - <% end %> - <% if m=measure('ncloc') %> - - - - - <% end %> - <% if m=measure('functions') %> - - - - - <% end %> - <% if m=measure('accessors') %> - - - - - <% end %> - <% if m=measure('paragraphs') %> - - - - - <% end %> -
Lines:<%= format_measure(m) -%>
Lines of code:<%= format_measure(m) -%>
Methods:<%= format_measure(m) -%>
Accessors:<%= format_measure(m) -%>
Paragraphs:<%= format_measure(m) -%>
- - - <% if m=measure('statements') %> - - - - - <% end %> - <% if m=measure('complexity') %> - - - - - <% end %> - <% if m=measure('function_complexity') %> - - - - - <% end %> - <% if m=measure('paragraph_complexity') %> - - - - - <% end %> -
Statements:<%= format_measure(m) -%>
Complexity:<%= format_measure(m) -%>
Complexity/method:<%= format_measure(m) -%>
Complexity/paragraph:<%= format_measure(m) -%>
- - - <% if m=measure('comment_lines_density') %> - - - - - <% end %> - <% if m=measure('comment_lines') %> - - - - - <% end %> - <% if m=measure('commented_out_code_lines') %> - - - - - <% end %> - <% if m=measure('comment_blank_lines') %> - - - - - <% end %> -
Comments:<%= format_measure(m) -%>
Comment lines:<%= format_measure(m) -%>
Commented-out LOC:<%= format_measure(m) -%>
Blank comments:<%= format_measure(m) -%>
- - - <% if m=measure('public_documented_api_density') %> - - - - - <% end %> - <% if m=measure('public_undocumented_api') %> - - - - - <% end %> - <% if m=measure('public_api') %> - - - - - <% end %> -
Public documented API:<%= format_measure(m) -%>
Public undocumented API:<%= format_measure(m) -%>
Public API:<%= format_measure(m) -%>
- - - <% if m=measure('classes') %> - - - - - <% end %> - <% if m=measure('noc') %> - - - - - <% end %> - <% if m=measure('dit') %> - - - - - <% end %> - <% if m=measure('rfc') %> - - - - - <% end %> -
Classes:<%= format_measure(m) -%>
Number of Children:<%= format_measure(m) -%>
Depth in Tree:<%= format_measure(m) -%>
Response for Class (RFC):<%= format_measure(m) -%>
- - <%= render :partial => 'options' -%> -
- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_violations.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_violations.html.erb deleted file mode 100644 index 797f6457311..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_header_violations.html.erb +++ /dev/null @@ -1,48 +0,0 @@ -
- - - - - -
<%= format_measure('violations', :default => '-') -%> violations
- - - - - - - -
<%= image_tag 'priority/BLOCKER.png' -%>Blocker:<%= format_measure('blocker_violations', :default => 0) -%>
- - - - - - -
<%= image_tag 'priority/CRITICAL.png' -%>Critical:<%= format_measure('critical_violations', :default => 0) -%>
- - - - - - -
<%= image_tag 'priority/MAJOR.png' -%>Major:<%= format_measure('major_violations', :default => 0) -%>
- - - - - - -
<%= image_tag 'priority/MINOR.png' -%>Minor:<%= format_measure('minor_violations', :default => 0) -%>
- - - - - - -
<%= image_tag 'priority/INFO.png' -%>Info:<%= format_measure('info_violations', :default => 0) -%>
- - <%= render :partial => 'options' -%> -
-
- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_options.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_options.html.erb deleted file mode 100644 index bd6d0dfe930..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_options.html.erb +++ /dev/null @@ -1,65 +0,0 @@ -<% display_options = @scm_available || @expandable || @snapshot.project_snapshot.periods? || @display_violations - if display_options -%> - -
- -
- - - - - - - <% first=true %> - <% if @scm_available %> - - <% first=false - end %> - - <% if @expandable %> - - <% first=false - end %> - - <% if @snapshot.project_snapshot.periods? %> - - <% - first=false - end %> - - <% if @display_violations %> - - <% end %> - -
- onclick="applyOptions()"/> - - - onclick="applyOptions()"/> - - - - <%= render :partial => 'rules_filter' -%>
-
-
-<% end %> \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_rules_filter.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_rules_filter.html.erb deleted file mode 100644 index 900711898b0..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_rules_filter.html.erb +++ /dev/null @@ -1,45 +0,0 @@ -<% - 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') - - rule_counts={} - rules=[] - rule_measures=ProjectMeasure.find(:all, :include => 'rule', :conditions => ['metric_id=? AND snapshot_id=? AND rule_id IS NOT NULL AND characteristic_id IS NULL', Metric.by_key('violations').id, @snapshot.id]) - rule_measures.each do |rule_measure| - rule_counts[rule_measure.rule_id]=rule_measure.value.to_i - rules< - \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_tabs.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_tabs.html.erb deleted file mode 100644 index 8627dc49ca7..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_tabs.html.erb +++ /dev/null @@ -1,37 +0,0 @@ - - -
- <%= qualifier_icon(@resource) -%> <%= @resource.long_name -%> -
- -
- -
    - <% if request.xhr? %> - <% @extensions.each do |extension| %> -
  • <%= extension.getTitle() -%>
  • - <% end %> - <% else %> - - <% @extensions.each do |extension| %> -
  • <%= extension.getTitle() -%>
  • - <% end %> - <% end %> -
  • - -
  • -
-
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_violation.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_violation.html.erb deleted file mode 100644 index c3feeb1f0b4..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/_violation.html.erb +++ /dev/null @@ -1,12 +0,0 @@ - - -<%= h(violation.rule.name) -%> - » -<%= h(violation.message) -%> -<% - if violation.created_at - duration=Date.today - violation.created_at.to_date - -%> - <%= duration==0 ? 'today' : "#{duration} days ago" -%> -<% end %> \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/extension.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/extension.html.erb deleted file mode 100644 index b61e6259fc4..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/extension.html.erb +++ /dev/null @@ -1,23 +0,0 @@ -<%= render :partial => 'tabs' -%> - -<% if @extension.isGwt() %> - - <% if request.xhr? %> -
- - - <% else %> - - -
- - - - <%= render :partial => 'gwt/base', :locals => {:resource => @resource, :popup => false, :metric => params[:metric]} -%> - - - <% end %> - -<% else # ruby on rails page %> - <%= render :inline => @page.getTemplate() %> -<% end %> \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/index.html.erb deleted file mode 100644 index afeba9ea647..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/index.html.erb +++ /dev/null @@ -1,103 +0,0 @@ -<%= render :partial => 'tabs' -%> - -<%= render :partial => "browse/header_#{@extension.getId()}" -%> - - -<% if @display_violations && @global_violations && @global_violations.size>0 -%> - - <% @global_violations.each do |violation| %> - - - - <% end %> -
<%= render :partial => 'violation', :locals => {:violation => violation} -%>
-<% end %> - -<% if @lines && @lines.size>0 %> - - <% - current_revision=nil - colspan=2 - colspan+=1 if @display_scm - colspan+=1 if @display_violations - colspan+=2 if @display_coverage - previous_hidden=false - first_section=true - @lines.each_with_index do |line, index| - if line.hidden - previous_hidden=true - next - end - - if previous_hidden && !first_section - current_revision=nil -%> - - - -<% - end - previous_hidden=false - first_section=false - - status=hits_status=conditions_status='' - if @display_coverage && line.hits - hits_status=(line.hits>0 ? 'ok' : 'ko') - if line.conditions && line.conditions>0 && line.covered_conditions - if line.covered_conditions==0 - status='ko' - conditions_status='ko' - elsif line.covered_conditions==line.conditions - status='' - conditions_status='ok' - else - conditions_status='warn' - status='warn' - end - elsif line.hits - status=(line.hits>0 ? '' : 'ko') - end - elsif @display_violations - status="sev#{line.violation_severity}" - end - %> - - <% if @display_scm - if current_revision!=line.revision - current_revision=line.revision - title = "Revision #{h(line.revision)} (#{l(line.datetime)})" - %> - - <% else %> - - <% end - end %> - <% if @display_violations %> - - <% end %> - - - <% if @display_coverage %> - - - <% end %> - - - <% end %> -
<%= l(line.date) -%> <%= h(line.author) -%> - <% if line.violations? - line.violations.each_with_index do |violation, violation_index| %> - <%= '
' if violation_index>0 %> - <%= render :partial => 'violation', :locals => {:violation => violation} -%> - <% - end - end - %> -
<%= index + 1 -%><%= line.hits -%> - <% if line.deprecated_conditions_label -%> - <%= line.deprecated_conditions_label -%> - <% elsif line.conditions && line.conditions>0 -%> - <%= line.covered_conditions -%>/<%= line.conditions -%> - <% end %> -
<%= line.source -%>
-<% end %> \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/nothing.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/browse/nothing.html.erb deleted file mode 100644 index d22506de4cf..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/browse/nothing.html.erb +++ /dev/null @@ -1 +0,0 @@ -<%= render :partial => 'tabs' -%> \ No newline at end of file -- 2.39.5