]> source.dussan.org Git - sonarqube.git/commitdiff
Rename some Ruby methods of Review.rb in order to respect convention namings
authorSimon Brandhof <simon.brandhof@gmail.com>
Fri, 9 Dec 2011 14:41:02 +0000 (15:41 +0100)
committerSimon Brandhof <simon.brandhof@gmail.com>
Mon, 12 Dec 2011 09:45:15 +0000 (10:45 +0100)
sonar-server/src/main/webapp/WEB-INF/app/controllers/api/reviews_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/controllers/reviews_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/models/review.rb
sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_review.html.erb

index 0d090f58905afd5ad13334954e0300ed32baa467..9aa8e7100e4e9a15a15c227a33c92d2a964f2169 100644 (file)
@@ -155,7 +155,7 @@ class Api::ReviewsController < Api::ApiController
       review = get_review(params[:id])
       review.transaction do
         comment = params[:comment] || request.raw_post
-        if review.isClosed?
+        if review.closed?
           raise "Closed review can not be commented."
         end
         raise "Comment must be provided." unless comment && !comment.blank?
@@ -187,7 +187,7 @@ class Api::ReviewsController < Api::ApiController
       review = get_review(params[:id])
       review.transaction do
         assignee = params[:assignee]
-        if !review.isOpen? && !review.isReopened?
+        if !review.open? && !review.reopened?
           raise "Only open review can be reassigned."
         end
         if assignee.blank?
@@ -227,7 +227,7 @@ class Api::ReviewsController < Api::ApiController
       review.transaction do
         resolution = params[:resolution]
         comment = params[:comment] || request.raw_post
-        if !review.isOpen? && !review.isReopened?
+        if !review.open? && !review.reopened?
           raise "Only open review can be resolved."
         end
         if resolution == Review::RESOLUTION_FALSE_POSITIVE
@@ -266,7 +266,7 @@ class Api::ReviewsController < Api::ApiController
       review = get_review(params[:id])
       review.transaction do
         comment = params[:comment] || request.raw_post
-        if !review.isResolved?
+        if !review.resolved?
           raise "Only resolved review can be reopened."
         end
         if review.resolution == Review::RESOLUTION_FALSE_POSITIVE
index 8631455ae9635dfb3062706822ba2ef2dbf936f4..189903eff56c0eac9009baa9c4802b8bc28ae631 100644 (file)
@@ -22,9 +22,9 @@ class ReviewsController < ApplicationController
 
   SECTION=Navigation::SECTION_HOME
 
-  verify :method => :post, 
+  verify :method => :post,
          :only => [:assign, :flag_as_false_positive, :save_comment, :delete_comment, :change_status,
-                   :violation_assign, :violation_flag_as_false_positive,:violation_save_comment, :violation_delete_comment, :violation_change_status], 
+                   :violation_assign, :violation_flag_as_false_positive, :violation_save_comment, :violation_delete_comment, :violation_change_status],
          :redirect_to => {:action => :error_not_post}
   helper SourceHelper, UsersHelper
 
@@ -32,7 +32,7 @@ class ReviewsController < ApplicationController
     init_params()
     search_reviews()
   end
-  
+
   # Used for the permalink, e.g. http://localhost:9000/reviews/view/1
   def view
     @review = Review.find(params[:id], :include => ['project'])
@@ -133,7 +133,7 @@ class ReviewsController < ApplicationController
       render :text => "<b>Cannot delete the comment</b> : access denied."
       return
     end
-    
+
     if @review
       @review.delete_comment(current_user, params[:comment_id].to_i)
     end
@@ -148,7 +148,7 @@ class ReviewsController < ApplicationController
       return
     end
 
-    if @review.isResolved?
+    if @review.resolved?
       @review.reopen(current_user)
     else
       # for the moment, if a review is not open, it can only be "RESOLVED"
@@ -168,7 +168,7 @@ class ReviewsController < ApplicationController
   # GET
   def display_violation
     violation = RuleFailure.find(params[:id])
-    render :partial => "resource/violation", :locals => { :violation => violation }
+    render :partial => "resource/violation", :locals => {:violation => violation}
   end
 
   # GET
@@ -190,7 +190,7 @@ class ReviewsController < ApplicationController
     violation.review.reassign(current_user, assignee)
     violation.save
 
-    render :partial => "resource/violation", :locals => { :violation => violation }
+    render :partial => "resource/violation", :locals => {:violation => violation}
   end
 
   # GET
@@ -206,7 +206,7 @@ class ReviewsController < ApplicationController
       return
     end
     sanitize_violation(violation)
-    
+
     unless params[:comment].blank?
       if violation.review.nil?
         violation.build_review(:user_id => current_user.id)
@@ -216,7 +216,7 @@ class ReviewsController < ApplicationController
       violation=RuleFailure.find(params[:id])
     end
 
-    render :partial => "resource/violation", :locals => { :violation => violation }
+    render :partial => "resource/violation", :locals => {:violation => violation}
   end
 
   # GET
@@ -240,8 +240,8 @@ class ReviewsController < ApplicationController
     unless violation.review
       assignee = findUserByLogin(params[:assignee_login]) unless params[:assignee_login].blank?
       violation.create_review!(
-          :assignee => assignee,
-          :user => current_user)
+        :assignee => assignee,
+        :user => current_user)
     end
 
     unless params[:text].blank?
@@ -252,7 +252,7 @@ class ReviewsController < ApplicationController
       end
     end
 
-    render :partial => "resource/violation", :locals => { :violation => violation }
+    render :partial => "resource/violation", :locals => {:violation => violation}
   end
 
   # POST
@@ -266,9 +266,9 @@ class ReviewsController < ApplicationController
     if violation.review
       violation.review.delete_comment(current_user, params[:comment_id].to_i)
     end
-    render :partial => "resource/violation", :locals => { :violation => violation }
+    render :partial => "resource/violation", :locals => {:violation => violation}
   end
-  
+
   # POST
   def violation_change_status
     violation = RuleFailure.find(params[:id], :include => 'snapshot')
@@ -277,18 +277,18 @@ class ReviewsController < ApplicationController
       return
     end
     sanitize_violation(violation)
-    
+
     if violation.review
       review = violation.review
-      if review.isResolved?
+      if review.resolved?
         review.reopen(current_user)
       else
         # for the moment, if a review is not open, it can only be "RESOLVED"
         review.resolve(current_user)
       end
-    end    
+    end
 
-    render :partial => "resource/violation", :locals => { :violation => violation }
+    render :partial => "resource/violation", :locals => {:violation => violation}
   end
 
 
@@ -297,7 +297,7 @@ class ReviewsController < ApplicationController
   # ACTIONS FROM THE REVIEW WIDGETS
   #
   #
-  
+
   # GET
   def widget_reviews_list
     @snapshot = Snapshot.find(params[:snapshot_id])
@@ -305,20 +305,19 @@ class ReviewsController < ApplicationController
       render :text => "<b>Cannot access the reviews of this project</b>: access denied."
       return
     end
-    
+
     @dashboard_configuration=Api::DashboardConfiguration.new(nil, :period_index => params[:period], :snapshot => @snapshot)
     render :partial => 'project/widgets/reviews/reviews_list'
   end
 
 
-
   ## -------------- PRIVATE -------------- ##
   private
-  
+
   def findUserByLogin(login)
-    User.find(:all, :conditions => [ "login = ?", login ]).first
+    User.find(:all, :conditions => ["login = ?", login]).first
   end
-  
+
   def init_params
     default_user = (current_user ? current_user.login : '')
     @assignee_login = params[:assignee_login] || default_user
@@ -367,7 +366,7 @@ class ReviewsController < ApplicationController
     if @to
       options['to']=@to
     end
-    unless @id  == ''
+    unless @id == ''
       if is_number? @id
         options['id'] = @id
       else
@@ -376,13 +375,13 @@ class ReviewsController < ApplicationController
     end
     options['sort'] = @sort unless @sort.blank?
     options['asc'] = @asc
-    
+
     found_reviews = Review.search(options)
     @reviews = select_authorized(:user, found_reviews, :project)
     if found_reviews.size != @reviews.size
       @security_exclusions = true
     end
-    
+
     # table pagination
     @page_size = 20
     @page_size = params[:page_size].to_i if is_number?(params[:page_size]) && params[:page_size].to_i > 5
@@ -401,7 +400,7 @@ class ReviewsController < ApplicationController
   def is_number?(s)
     true if Float(s) rescue false
   end
-  
+
   def has_rights_to_modify?(object)
     current_user && has_role?(:user, object)
   end
index ce5e94d0176dbbec99a0f34236e8af536b296e03..a222fb837d9658a9d1c82566406685b0a2aaa463 100644 (file)
@@ -184,19 +184,19 @@ class Review < ActiveRecord::Base
     (status == STATUS_RESOLVED && resolution == RESOLUTION_FALSE_POSITIVE) || status == STATUS_OPEN || status == STATUS_REOPENED
   end
 
-  def isResolved?
+  def resolved?
     status == STATUS_RESOLVED
   end
 
-  def isClosed?
+  def closed?
     status == STATUS_CLOSED
   end
 
-  def isReopened?
+  def reopened?
     status == STATUS_REOPENED
   end
 
-  def isOpen?
+  def open?
     status == STATUS_OPEN
   end
 
index 9d3c1ff5cc5474fdedec651b7769735509d662be..9b59550f79849466a70133ff94e90aad733d5a2b 100644 (file)
 <div id="vId<%= violation.id -%>">
-<div class="violation">
-  <div class="vtitle">
-    <% if violation.review %>
-      <div class="review_permalink"><span class="review_permalink"><%= link_to "Review #"+violation.review.id.to_s, :controller => "reviews", :action => "view", :id => violation.review.id -%></span></div>
-    <% end %>
-    
-    <%= image_tag("priority/" + violation.failure_level.to_s + '.png') -%>
-    &nbsp;
-    <img src="<%= ApplicationController.root_context -%>/images/sep12.png">
-    &nbsp;
-    <span class="rulename" <%= 'style="text-decoration: line-through"' if violation.review && violation.review.isResolved? %> >
-      <a onclick="window.open(this.href,'rule','height=800,width=900,scrollbars=1,resizable=1');return false;" href="<%= url_for :controller => 'rules', :action => 'show', :id => violation.rule.key, :layout => 'false' -%>"><%= h(violation.rule.name) -%></a>
-    </span>
-    &nbsp;
-    <img src="<%= ApplicationController.root_context -%>/images/sep12.png">
-    &nbsp;
-    <% if violation.created_at %>
-         <span class="violation_date"><%= distance_of_time_in_words_to_now(violation.created_at) -%></span>
-      &nbsp;
-    <% end %>
-    <% if violation.switched_off? %>
-      <img src="<%= ApplicationController.root_context -%>/images/sep12.png">
-      &nbsp;
-      <span class="falsePositive"><%= message('false_positive') -%></span>
+  <div class="violation">
+    <div class="vtitle">
+      <% if violation.review %>
+        <div class="review_permalink"><span class="review_permalink"><%= link_to "Review #"+violation.review.id.to_s, :controller => "reviews", :action => "view", :id => violation.review.id -%></span>
+        </div>
+      <% end %>
+
+      <%= image_tag("priority/" + violation.failure_level.to_s + '.png') -%>
       &nbsp;
-    <% end %>
-    <% if violation.review && violation.review.isReopened? %>
       <img src="<%= ApplicationController.root_context -%>/images/sep12.png">
       &nbsp;
-      <span class="review-reopened"><%= message('reopened') -%></span>
+    <span class="rulename" <%= 'style="text-decoration: line-through"' if violation.review && violation.review.resolved? %> >
+      <a onclick="window.open(this.href,'rule','height=800,width=900,scrollbars=1,resizable=1');return false;" href="<%= url_for :controller => 'rules', :action => 'show', :id => violation.rule.key, :layout => 'false' -%>"><%= h(violation.rule.name) -%></a>
+    </span>
       &nbsp;
-    <% end %>
-    <% if violation.review && violation.review.assignee_id %>
       <img src="<%= ApplicationController.root_context -%>/images/sep12.png">
       &nbsp;
-      <%= message('assigned_to') -%>: <%= h(violation.review.assignee.name) -%>
-      &nbsp;
-    <% end %>
-    
-    <% if current_user %>
+      <% if violation.created_at %>
+        <span class="violation_date"><%= distance_of_time_in_words_to_now(violation.created_at) -%></span>
+        &nbsp;
+      <% end %>
+      <% if violation.switched_off? %>
+        <img src="<%= ApplicationController.root_context -%>/images/sep12.png">
+        &nbsp;
+        <span class="falsePositive"><%= message('false_positive') -%></span>
+        &nbsp;
+      <% end %>
+      <% if violation.review && violation.review.reopened? %>
+        <img src="<%= ApplicationController.root_context -%>/images/sep12.png">
+        &nbsp;
+        <span class="review-reopened"><%= message('reopened') -%></span>
+        &nbsp;
+      <% end %>
+      <% if violation.review && violation.review.assignee_id %>
+        <img src="<%= ApplicationController.root_context -%>/images/sep12.png">
+        &nbsp;
+        <%= message('assigned_to') -%>: <%= h(violation.review.assignee.name) -%>
+        &nbsp;
+      <% end %>
+
+      <% if current_user %>
     <span class="actions" id="vActions<%= violation.id -%>">
       <img src="<%= ApplicationController.root_context -%>/images/sep12.png">
-        <% 
-          if violation.review 
-            unless violation.switched_off?
-        %>
+      <%
+         if violation.review
+           unless violation.switched_off?
+      %>
         &nbsp;
-        <%= link_to_remote (violation.review.isResolved? ? message('reopen') : message('resolve')),  
-                       :url => { :controller => "reviews", :action => "violation_change_status", :id => violation.id},
-                       :update => "vId" + violation.id.to_s,
-                       :confirm => violation.review.isResolved? ? message('reviews.do_you_want_to_reopen') : message('reviews.do_you_want_to_resolve') -%>
-          
-              <% unless violation.review && violation.review.isResolved? %>
+          <%= link_to_remote (violation.review.resolved? ? message('reopen') : message('resolve')),
+                             :url => {:controller => "reviews", :action => "violation_change_status", :id => violation.id},
+                             :update => "vId" + violation.id.to_s,
+                             :confirm => violation.review.resolved? ? message('reviews.do_you_want_to_reopen') : message('reviews.do_you_want_to_resolve') -%>
+
+          <% unless violation.review && violation.review.resolved? %>
                        &nbsp;
-                       <%= link_to_remote (violation.review.assignee_id ? message('reassign') : message('assign')),  
-                                       :url => { :controller => "reviews", :action => "violation_assign_form", :violation_id => violation.id},
-                                       :update => "vActions" + violation.id.to_s,
-                                       :complete => "$('vActions" + violation.id.to_s + "').show();$('commentActions" + violation.id.to_s + "').hide();$('assignee_login').focus();" -%>
+            <%= link_to_remote (violation.review.assignee_id ? message('reassign') : message('assign')),
+                               :url => {:controller => "reviews", :action => "violation_assign_form", :violation_id => violation.id},
+                               :update => "vActions" + violation.id.to_s,
+                               :complete => "$('vActions" + violation.id.to_s + "').show();$('commentActions" + violation.id.to_s + "').hide();$('assignee_login').focus();" -%>
                <%
-                     end
-            end 
-          else 
-        %>        
+       end
+       end
+       else
+    %>
         &nbsp;
         <%= link_to_remote message('review_verb'),
-               :url => { :controller => "reviews", :action => "violation_comment_form", :id => violation.id },
-               :update => "reviewForm" + violation.id.to_s,
-               :complete => "$('reviewForm" + violation.id.to_s + "').show();$('commentText" + violation.id.to_s + "').focus();$('vActions#{violation.id}').hide();" -%>
+                           :url => {:controller => "reviews", :action => "violation_comment_form", :id => violation.id},
+                           :update => "reviewForm" + violation.id.to_s,
+                           :complete => "$('reviewForm" + violation.id.to_s + "').show();$('commentText" + violation.id.to_s + "').focus();$('vActions#{violation.id}').hide();" -%>
         <% end %>
-      
-        &nbsp;
-        <% if (!violation.review) || (violation.review && violation.review.can_change_false_positive_flag?) %>
+
+      &nbsp;
+      <% if (!violation.review) || (violation.review && violation.review.can_change_false_positive_flag?) %>
         <%= link_to_remote (violation.switched_off? ? message('reviews.unflag_as_false_positive') : message('reviews.flag_as_false_positive')),
-                       :url => { :controller => "reviews", :action => "violation_false_positive_form", :id => violation.id, :false_positive => !violation.switched_off? },
-                       :update => "reviewForm" + violation.id.to_s,
-                       :complete => "$('reviewForm" + violation.id.to_s + "').show();$('commentText" + violation.id.to_s + "').focus();$('vActions" + violation.id.to_s + "').hide();$('commentActions" + violation.id.to_s + "').hide();" -%>
+                           :url => {:controller => "reviews", :action => "violation_false_positive_form", :id => violation.id, :false_positive => !violation.switched_off?},
+                           :update => "reviewForm" + violation.id.to_s,
+                           :complete => "$('reviewForm" + violation.id.to_s + "').show();$('commentText" + violation.id.to_s + "').focus();$('vActions" + violation.id.to_s + "').hide();$('commentActions" + violation.id.to_s + "').hide();" -%>
         <% end %>
     </span>
-    <% end %>
-    
-  </div>
+      <% end %>
 
-  <div class="discussionComment first">
-    <%= violation.html_message -%>
-  </div>
+    </div>
+
+    <div class="discussionComment first">
+      <%= violation.html_message -%>
+    </div>
 
-  <% 
-    if violation.review
-      violation.review.comments.each_with_index do |review_comment, comment_index|
-      is_last_comment=(comment_index==violation.review.comments.size-1)
-  %>
-  <div class="discussionComment">
-    <h4><%= image_tag("reviews/comment.png") -%> &nbsp;<b><%= review_comment.user.name -%></b> (<%= distance_of_time_in_words_to_now(review_comment.created_at) -%>)
-    <% if is_last_comment && current_user %>
+    <%
+       if violation.review
+         violation.review.comments.each_with_index do |review_comment, comment_index|
+           is_last_comment=(comment_index==violation.review.comments.size-1)
+    %>
+        <div class="discussionComment">
+          <h4><%= image_tag("reviews/comment.png") -%> &nbsp;<b><%= review_comment.user.name -%></b> (<%= distance_of_time_in_words_to_now(review_comment.created_at) -%>)
+            <% if is_last_comment && current_user %>
       <span class="actions" id="commentActions<%= violation.id -%>">
         &nbsp;&nbsp;
         <img src="<%= ApplicationController.root_context -%>/images/sep12.png">
         &nbsp;&nbsp;
         <%= link_to_remote message('add_comment'),
-               :url => { :controller => "reviews", :action => "violation_comment_form", :id => violation.id },
-               :update => "reviewForm" + violation.id.to_s,
-               :complete => "$('vActions#{violation.id}').hide();$('commentActions" + violation.id.to_s + "').hide();$('reviewForm" + violation.id.to_s + "').show();$('commentText" + violation.id.to_s + "').focus()" -%>
-        <% 
-          if current_user.id == review_comment.user_id 
+                           :url => {:controller => "reviews", :action => "violation_comment_form", :id => violation.id},
+                           :update => "reviewForm" + violation.id.to_s,
+                           :complete => "$('vActions#{violation.id}').hide();$('commentActions" + violation.id.to_s + "').hide();$('reviewForm" + violation.id.to_s + "').show();$('commentText" + violation.id.to_s + "').focus()" -%>
+        <%
+           if current_user.id == review_comment.user_id
         %>
           &nbsp;
-          <%= link_to_remote message('edit'), 
-            :url => { :controller => "reviews", :action => "violation_comment_form", :comment_id => review_comment.id, :id => violation.id },
-            :update => "lastComment" + violation.id.to_s,
-            :complete => "$('vActions#{violation.id}').hide();$('commentActions#{violation.id}').hide();$('commentText#{violation.id}').focus();" -%>
+          <%= link_to_remote message('edit'),
+                             :url => {:controller => "reviews", :action => "violation_comment_form", :comment_id => review_comment.id, :id => violation.id},
+                             :update => "lastComment" + violation.id.to_s,
+                             :complete => "$('vActions#{violation.id}').hide();$('commentActions#{violation.id}').hide();$('commentText#{violation.id}').focus();" -%>
           <% unless comment_index == 0 %>
           &nbsp;
-          <%= link_to_remote message('delete'),
-               :url => { :controller => "reviews", :action => "violation_delete_comment", :comment_id => review_comment.id, :id => violation.id },
-               :update => "vId" + violation.id.to_s,
-            :confirm => message('reviews.do_you_want_to_delete_comment') -%>
+            <%= link_to_remote message('delete'),
+                               :url => {:controller => "reviews", :action => "violation_delete_comment", :comment_id => review_comment.id, :id => violation.id},
+                               :update => "vId" + violation.id.to_s,
+                               :confirm => message('reviews.do_you_want_to_delete_comment') -%>
           <% end %>
         <%
-          end 
+           end
         %>
       </span>
-    <% end %>
-    </h4> 
-      <% if is_last_comment %>
-        <div id="lastComment<%= violation.id -%>">
-          <%= review_comment.html_text -%>
+            <% end %>
+          </h4>
+          <% if is_last_comment %>
+            <div id="lastComment<%= violation.id -%>">
+              <%= review_comment.html_text -%>
+            </div>
+          <% else %>
+            <%= review_comment.html_text -%>
+          <% end %>
         </div>
-      <% else %>
-        <%= review_comment.html_text -%>
-      <% end %>
-  </div>
-  <% 
-      end
-    end
-  %>
+      <%
+         end
+         end
+      %>
 
-  <div class="discussionComment" id="reviewForm<%= violation.id -%>" style="display:none"></div>
-</div>
+    <div class="discussionComment" id="reviewForm<%= violation.id -%>" style="display:none"></div>
+  </div>
 
 </div>
\ No newline at end of file
index 58a3faa75421d551fd43b3bf4e39bf142de6e2d0..5ccf941cf08801b34da1c9fcfdac011aea8ba168 100644 (file)
       &nbsp;
       <span class="falsePositive"><%= message('false_positive') -%></span>
     <% end %>
-    
-    <% 
-      if current_user && !review.isClosed? && review.rule_failure
-        violation_switched_off = review.rule_failure.switched_off?
+
+    <%
+       if current_user && !review.closed? && review.rule_failure
+         violation_switched_off = review.rule_failure.switched_off?
     %>
     <span class="actions" id="rActions">
         &nbsp;
-        <%= image_tag("sep12.png") -%>
+      <%= image_tag("sep12.png") -%>
+      &nbsp;
+      <%
+         if !violation_switched_off
+      %>
+          <%= link_to_remote (review.resolved? ? message('reopen') : message('resolve')),
+                             :url => {:controller => "reviews", :action => "change_status", :id => review.id},
+                             :update => "review",
+                             :confirm => review.resolved? ? message('reviews.do_you_want_to_reopen') : message('reviews.do_you_want_to_resolve') -%>
         &nbsp;
-        <% 
-          if !violation_switched_off
-        %>
-          <%= link_to_remote (review.isResolved? ? message('reopen') : message('resolve')),  
-                       :url => { :controller => "reviews", :action => "change_status", :id => review.id},
-                       :update => "review",
-                       :confirm => review.isResolved? ? message('reviews.do_you_want_to_reopen') : message('reviews.do_you_want_to_resolve') -%>
+        <% unless review.resolved? %>
+               <%= link_to_remote (review.assignee_id ? message('reassign') : message('assign')),
+                             :url => {:controller => "reviews", :action => "assign_form", :review_id => review.id},
+                             :update => "assignForm",
+                             :complete => "$('rActions').hide(); $('editActions').hide(); $('assignee_login').focus();" -%>
+
           &nbsp;
-          <% unless review.isResolved? %>
-               <%= link_to_remote (review.assignee_id ? message('reassign') : message('assign')),  
-                               :url => { :controller => "reviews", :action => "assign_form", :review_id => review.id},
-                               :update => "assignForm",
-                               :complete => "$('rActions').hide(); $('editActions').hide(); $('assignee_login').focus();" -%>
-             
-               &nbsp;
           <% end %>
         <% end %>
-        <% if review.can_change_false_positive_flag? %>
+      <% if review.can_change_false_positive_flag? %>
           <%= link_to_remote (violation_switched_off ? message('reviews.unflag_as_false_positive') : message('reviews.flag_as_false_positive')),
-                       :url => { :controller => "reviews", :action => "false_positive_form", :id => review.id, :false_positive => !violation_switched_off },
-                       :update => "reviewForm",
-                       :complete => "$('reviewForm').show(); $('rActions').hide(); $('editActions').hide(); $('commentText').focus();" -%>
+                             :url => {:controller => "reviews", :action => "false_positive_form", :id => review.id, :false_positive => !violation_switched_off},
+                             :update => "reviewForm",
+                             :complete => "$('reviewForm').show(); $('rActions').hide(); $('editActions').hide(); $('commentText').focus();" -%>
         <% end %>
     </span>
     <% end %>
-    
+
   </div>
 
   <table class="reportDetails">
-        <tr>
-          <td class="key">
-            <%= message('status') -%>: 
-          </td>
-          <td  class="val">
-               <%= image_tag "status/#{review.status}.png" -%> <%= message(review.status.downcase).capitalize -%>
-          </td>
-          <td class="key">
-         <%= message('severity') -%>:
-          </td>
-          <td  class="val">
-          <%= image_tag "priority/#{review.severity}.png" -%> <%= message(review.severity.downcase).capitalize -%>
-          </td>
-        </tr>
-        <tr>
-          <td class="key">
-            <%= message('assignee') -%>:       
-          </td>
-          <td  class="val">
+    <tr>
+      <td class="key">
+        <%= message('status') -%>:
+      </td>
+      <td class="val">
+        <%= image_tag "status/#{review.status}.png" -%> <%= message(review.status.downcase).capitalize -%>
+      </td>
+      <td class="key">
+        <%= message('severity') -%>:
+      </td>
+      <td class="val">
+        <%= image_tag "priority/#{review.severity}.png" -%> <%= message(review.severity.downcase).capitalize -%>
+      </td>
+    </tr>
+    <tr>
+      <td class="key">
+        <%= message('assignee') -%>:
+      </td>
+      <td class="val">
             <span id="assignForm">
-                <%= review.assignee ? h(review.assignee.name) : '-'-%>
+                <%= review.assignee ? h(review.assignee.name) : '-' -%>
             </span>
-          </td>
-          <td class="key">
-                 <%= message('author') -%>:
-          </td>
-          <td  class="val">
-                 <%= h(review.user.name) -%>
-          </td>
-        </tr>
-        <tr>
-          <td class="key">
-            <%= message('created') -%>:
-       </td>
-          <td  class="val">
-         <%= l(review.created_at) -%>
-       </td>
-          <td class="key">
-                 <%= message('updated') -%>:
-          </td>
-          <td  class="val">
-                 <%= l(review.updated_at) -%>
-          </td>
-        </tr>
-       <% if review.rule %>
-       <tr>
-          <td class="key">
-            <%= message('rule') -%>:   
-          </td>
-          <td class="val" colspan="3">
-                 <a onclick="window.open(this.href,'rule','height=800,width=900,scrollbars=1,resizable=1');return false;" href="<%= url_for :controller => 'rules', :action => 'show', :id => review.rule.key, :layout => 'false' -%>"><%= h(review.rule.name) -%></a>
-          </td>
-       </tr>
-       <% end %>
-       <tr>
-          <td class="key">
-            <%= message('file') -%>:   
-          </td>
-          <td class="val" colspan="3">
-               <%= qualifier_icon(review.resource) -%> 
-               <% if !review.on_project? %> <%= review.project.long_name -%> <%= image_tag 'sep12.png' -%> <% end %>
-               <%= link_to_resource(review.resource, review.resource.long_name, { :tab => :violations, :rule => review.false_positive ? "f-positive" : "" } ) %>
-          </td>
-        </tr>
+      </td>
+      <td class="key">
+        <%= message('author') -%>:
+      </td>
+      <td class="val">
+        <%= h(review.user.name) -%>
+      </td>
+    </tr>
+    <tr>
+      <td class="key">
+        <%= message('created') -%>:
+      </td>
+      <td class="val">
+        <%= l(review.created_at) -%>
+      </td>
+      <td class="key">
+        <%= message('updated') -%>:
+      </td>
+      <td class="val">
+        <%= l(review.updated_at) -%>
+      </td>
+    </tr>
+    <% if review.rule %>
+      <tr>
+        <td class="key">
+          <%= message('rule') -%>:
+        </td>
+        <td class="val" colspan="3">
+          <a onclick="window.open(this.href,'rule','height=800,width=900,scrollbars=1,resizable=1');return false;" href="<%= url_for :controller => 'rules', :action => 'show', :id => review.rule.key, :layout => 'false' -%>"><%= h(review.rule.name) -%></a>
+        </td>
+      </tr>
+    <% end %>
+    <tr>
+      <td class="key">
+        <%= message('file') -%>:
+      </td>
+      <td class="val" colspan="3">
+        <%= qualifier_icon(review.resource) -%>
+        <% if !review.on_project? %> <%= review.project.long_name -%> <%= image_tag 'sep12.png' -%>
+        <% end %>
+        <%= link_to_resource(review.resource, review.resource.long_name, {:tab => :violations, :rule => review.false_positive ? "f-positive" : ""}) %>
+      </td>
+    </tr>
   </table>
 
   <% if review.rule_failure && review.resource_line && review.rule_failure.snapshot && has_role?(:codeviewer, review.project) %>
   <% end %>
 
   <div class="discussion">
-        <% if review.rule_failure %>
-          <div class="discussionComment first">
-           <%= h(review.rule_failure.message) -%>
-          </div>
-        <% end %>
-        <% 
-           review.comments.each_with_index do |comment, comment_index| 
-             is_last_comment=(comment_index==review.comments.size-1)
-        %>
-          <div class="discussionComment">
-                <h4>
-                  <%= image_tag("reviews/comment.png") -%> &nbsp;<b><%= comment.user.name -%></b> (<%= distance_of_time_in_words_to_now(comment.created_at) -%>)
-           <% if is_last_comment && current_user && !review.isClosed? %>
+    <% if review.rule_failure %>
+      <div class="discussionComment first">
+        <%= h(review.rule_failure.message) -%>
+      </div>
+    <% end %>
+    <%
+       review.comments.each_with_index do |comment, comment_index|
+         is_last_comment=(comment_index==review.comments.size-1)
+    %>
+      <div class="discussionComment">
+        <h4>
+          <%= image_tag("reviews/comment.png") -%> &nbsp;<b><%= comment.user.name -%></b> (<%= distance_of_time_in_words_to_now(comment.created_at) -%>)
+          <% if is_last_comment && current_user && !review.closed? %>
            <span class="actions" id="editActions">
              &nbsp;&nbsp;
              <%= image_tag("sep12.png") -%>
              &nbsp;&nbsp;
              <%= link_to_remote message('add_comment'),
-                    :url => { :controller => "reviews", :action => "comment_form", :id => review.id },
-                    :update => "reviewForm",
-                    :complete => "$('rActions').hide();$('editActions').hide();$('reviewForm').show();$('commentText').focus();" -%>
+                                :url => {:controller => "reviews", :action => "comment_form", :id => review.id},
+                                :update => "reviewForm",
+                                :complete => "$('rActions').hide();$('editActions').hide();$('reviewForm').show();$('commentText').focus();" -%>
              <%
-               if current_user.id == comment.user_id
+                if current_user.id == comment.user_id
              %>
                &nbsp;
-               <%= link_to_remote message('edit'), 
-                 :url => { :controller => "reviews", :action => "comment_form", :comment_id => comment.id, :id => review.id },
-                    :update => "lastComment",
-                    :complete => "$('rActions').hide();$('editActions').hide();$('commentText').focus();" -%>
-                  <% unless comment_index == 0 %>
+               <%= link_to_remote message('edit'),
+                                  :url => {:controller => "reviews", :action => "comment_form", :comment_id => comment.id, :id => review.id},
+                                  :update => "lastComment",
+                                  :complete => "$('rActions').hide();$('editActions').hide();$('commentText').focus();" -%>
+               <% unless comment_index == 0 %>
                &nbsp;
-               <%= link_to_remote message('delete'),
-                    :url => { :controller => "reviews", :action => "delete_comment", :comment_id => comment.id, :id => review.id },
-                :update => "review",
-                 :confirm => message('reviews.do_you_want_to_delete_comment') -%>
+                 <%= link_to_remote message('delete'),
+                                    :url => {:controller => "reviews", :action => "delete_comment", :comment_id => comment.id, :id => review.id},
+                                    :update => "review",
+                                    :confirm => message('reviews.do_you_want_to_delete_comment') -%>
                <% end %>
-             <% 
-               end 
+             <%
+                end
              %>
            </span>
-           <% end %>
-         </h4>
-         <% if is_last_comment %>
-           <div id="lastComment">
-             <%= comment.html_text -%>
-           </div>
-         <% else %>
-           <%= comment.html_text -%>
-         <% end %>
-          </div>
-        <% end %>
+          <% end %>
+        </h4>
+        <% if is_last_comment %>
+          <div id="lastComment">
+            <%= comment.html_text -%>
+          </div>
+        <% else %>
+          <%= comment.html_text -%>
+        <% end %>
+      </div>
+    <% end %>
   </div>
-  
+
   <div class="discussionComment" id="reviewForm" style="display:none"></div>
-  
+
 </div>
\ No newline at end of file