Code Review Plugin

Added by Haruyuki Iida over 5 years ago

Hi. Let me announce to you My "Code Review Plugin" .It makes you can write code reviews of committed source code on Redmine's "Diff" page of repository browser.

like this...

Adding review.

Adding rview

Showing reviews.

Showing reviews

I tested this plugin on Redmine 0.8.3 and current trunk.
I hope you will like this plugin. Thanks.

add_review.png - Adding rview (21.4 KB)

show_reviews.png - Showing reviews (45 KB)

Replies (118)

RE: Code Review Plugin - Added by Haruyuki Iida over 5 years ago

plugin is here.

redmine_code_review-0.1.0.zip - Code Review Plugin 0.1.0 (33.1 KB)

RE: Code Review Plugin - Added by Andrew Chaika over 5 years ago

Nice plugin, but I have catch an error:

ActionView::TemplateError (Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id) on line #50 of vendor/plugins/redmine_code_review/app/views/code_review/_new_form.html.erb:
47: </p>
48: <p>
49:       <%= submit_to_remote 'apply', l(:button_apply), :update => 'review-form',
50:         :url => {:controller => 'code_review', :action => 'new', :id=>@project, :line => @line}, :method => :post, :change_id => @change.id, 220 => "$('review-form-frame').hide();" %>
51:       <input type="button" value="<%=h l(:button_cancel) %> " onclick="$('review-form-frame').hide();"/>
52: </p>
53:  <%= wikitoolbar_for 'review_comment' %>
    vendor/plugins/redmine_code_review/app/views/code_review/_new_form.html.erb:50
    D:/Work/New/Redmine/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/helpers/form_helper.rb:313:in `fields_for'
    D:/Work/New/Redmine/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/helpers/form_helper.rb:253:in `form_for'

after changing the 50-th line to:
        :url => {:controller => 'code_review', :action => 'new', :id=>@project, :line => @line}, :method => :post, :change_id => @review.change_id, 220 => "$('review-form-frame').hide();" %>

all work okay.
I think that "My page" block with code reviews will be useful or maybe mail notification.

RE: Code Review Plugin - Added by Andrew Chaika over 5 years ago

PS It's good idea with popup windows, I think that It's need to use they in other places of Redmine, for example when there is used Web 1.0 legacy "input" JavaScript function.

RE: Code Review Plugin - Added by Thomas M over 5 years ago

Very interesting,
by the way I have also catched an error.

When clicking on a review from the Code Review list (project wise) I got a Redmine "Revision not found" error.

The trace is :

Processing CodeReviewController#update_diff_view (for 152.xx.xx.xx at 2009-05-11 11:18:56) [POST]
  Session ID: b1673107f867f1f24ebb1d59cc4bf3e7
  Parameters: {"rev"=>"847", "action"=>"update_diff_view", "id"=>"tools-workshop", "controller"=>"code_review", "review_id"=>"1", "path"=>"/io/bla/BLA/dev_verif/sources/com.c"}

NoMethodError (undefined method `changes' for nil:NilClass):
    /vendor/plugins/redmine_code_review/app/controllers/code_review_controller.rb:78:in `update_diff_view'
    /vendor/rails/actionpack/lib/action_controller/base.rb:1166:in `send'
    /vendor/rails/actionpack/lib/action_controller/base.rb:1166:in `perform_action_without_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:579:in `call_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:572:in `perform_action_without_benchmark'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
    C:/Work/Ruby/Ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
    /vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
    /vendor/rails/actionpack/lib/action_controller/rescue.rb:201:in `perform_action_without_caching'
    /vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in `perform_action'
    /vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'
    /vendor/rails/activerecord/lib/active_record/query_cache.rb:8:in `cache'
    /vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:12:in `perform_action'
    /vendor/rails/actionpack/lib/action_controller/base.rb:529:in `send'
    /vendor/rails/actionpack/lib/action_controller/base.rb:529:in `process_without_filters'
    /vendor/rails/actionpack/lib/action_controller/filters.rb:568:in `process_without_session_management_support'
    /vendor/rails/actionpack/lib/action_controller/session_management.rb:130:in `process'
    /vendor/rails/actionpack/lib/action_controller/base.rb:389:in `process'

Your work is very promising, but it does not really fit my needs as is.
Here are some points :
  • I think that having one "Review" (in the list) per comment is far too much
  • I think that commenting right from the diff view is simple but to systematic (even if it may be solved with rights)
To my mind a code review is :
  • a list of file diffs (why not having a creation process with start/end path and revisions ?)
  • reviewed by several guys (not only the author)
  • finally acknowledged by someone (the project manager ?)

While waiting for your point of view please accept my best greatings for your work !

RE: Code Review Plugin - Added by Haruyuki Iida over 5 years ago

Hi, Andrew.

Thank you for your bug reporting. I fixed my plugin.
And your "My page" block idea seems very usefull. I will try it.

redmine_code_review-0.1.1.zip - Code Review Plugin 0.1.1 (33.1 KB)

RE: Code Review Plugin - Added by Haruyuki Iida over 5 years ago

Hi. Thomas

Thank you for your error reporting.
But unfortunately I can't fix it yet. Please wait.

And I understand your thought for my plugin. It seems quite difficult. I will examine how to implement it.

RE: Code Review Plugin - Added by Thomas M over 5 years ago

Hi Haru,
thanks for your answer, if you need more info feel free to ask.

You will find enclosed a French translation, I was not able to use Latin characters (rake error during db:migrate_plugins) : any idea ?

fr.yml Magnifier (624 Bytes)

RE: Code Review Plugin - Added by Adrian Tarau over 5 years ago

Very nice,

Does the committer receives a notification about the review? Actually it should be sent to every user...if the per user notification is enabled.

RE: Code Review Plugin - Added by Haruyuki Iida over 5 years ago

Hi Thomas,

Thanks for Frech translation. I made a new package which contains your file and a few bug fixes.
You can download it form Google Code.

http://code.google.com/p/r-labs/downloads/list

if you need more info feel free to ask.

Well, I have a few questions about a error you reported.
  • What kind of SCM do you use? Subversion?
  • Does the error occurs on every review you created?

You will find enclosed a French translation, I was not able to use Latin characters (rake error during db:migrate_plugins) : any idea ?

Sorry, I have no idea about it.

RE: Code Review Plugin - Added by Haruyuki Iida over 5 years ago

Adrian Tarau wrote:

Does the committer receives a notification about the review? Actually it should be sent to every user...if the per user notification is enabled.

Thank you for a comment. Maybe in a few weeks.

RE: Code Review Plugin - Added by Thomas M over 5 years ago

Haru Iida wrote:

You can download it form Google Code.

http://code.google.com/p/r-labs/downloads/list

I will test it tomorrow and let you know.

if you need more info feel free to ask.

Well, I have a few questions about a error you reported.
  • What kind of SCM do you use? Subversion?
  • Does the error occurs on every review you created?

Yes I'm using SVN and the error occurs on every review.

You will find enclosed a French translation, I was not able to use Latin characters (rake error during db:migrate_plugins) : any idea ?

Sorry, I have no idea about it.

I will have a look into the other plugins (who have worked ;))

RE: Code Review Plugin - Added by Thomas M over 5 years ago

I have several projects hosted in different repositories and I think that something is going wrong when creating a new review :
  • in the list, directory and file name are not the correct ones (it is a real file but from another repository at another revision)
  • when opening the correct file back from the repository viewer the reviews are well placed !

RE: Code Review Plugin - Added by Muhamed niyas over 5 years ago

Haru Iida wrote:

plugin is here.

Good work. I could do the code commenting very well.
The path showing in the 'code review' tab is wrong for each code comment.
If we click on the path redmine shows an error message like
"The entry or revision was not found in the repository."

Can you help me to fix this issue.?
pls find the screen shot attached...

I have another doubt..
How can v upload a photo of the user in redmine?

code_coment.jpg - code review details (41.7 KB)

RE: Code Review Plugin - Added by Haruyuki Iida over 5 years ago

Thank you.

But I also have several projects and repositories too. 2 SVNs, git, Mercurial and CVS. Each project works well.
What version of your redmine? and Is it running on development mode or production mode?

RE: Code Review Plugin - Added by Haruyuki Iida over 5 years ago

Hi Muhamed

Thanks. Your problem is maybe same as Thomas M's one. and I'm trying to fix it. Please wait.

I have another doubt..
How can v upload a photo of the user in redmine?

Use Gravater or Local avatars Plugin.
http://www.redmine.org/boards/3/topics/5365

RE: Code Review Plugin - Added by Thomas M over 5 years ago

Haru Iida wrote:

Thank you.

But I also have several projects and repositories too. 2 SVNs, git, Mercurial and CVS. Each project works well.
What version of your redmine? and Is it running on development mode or production mode?

I'm using Redmine 0.8.3 in production mode (with recommended ruby/rails settings and MySQL).

RE: Code Review Plugin - Added by Muhamed niyas over 5 years ago

Haru Iida wrote:

Thank you.

But I also have several projects and repositories too. 2 SVNs, git, Mercurial and CVS. Each project works well.
What version of your redmine? and Is it running on development mode or production mode?

Thanks for your immediate response.

I am using redmine 0.8.3 version. and redmine is running in production mode.

RE: Code Review Plugin - Added by Denis Tomashenko over 5 years ago

Great plugin. Thank you!

Some questions and bugs:
1. If all reviews are closed - there is no checkbox "Show closed reviews" and I can't view closed reviews.
2. Can I make link to review like "r100" or "#100"?

RE: Code Review Plugin - Added by Denis Tomashenko over 5 years ago

3. If I close review - initial review on activity page is removed. Stay only closed entry.
4. Maybe use different image for closed reviews?

And once again - thank you.

RE: Code Review Plugin - Added by Haruyuki Iida over 5 years ago

Hi Denis.

Thanks for your report.

I released redmine_code_review-0.1.3.zip on http://code.google.com/p/r-labs/downloads/list

Denis Tomashenko wrote:

1. If all reviews are closed - there is no checkbox "Show closed reviews" and I can't view closed reviews.

I fixed.

2. Can I make link to review like "r100" or "#100"?

I wrote wiki macro. Write "{{review(review_no)}}" in wiki format.
ex. linkng to review no. 8.

{{review(8)}}

Try it.

Thank you.

RE: Code Review Plugin - Added by Denis Tomashenko over 5 years ago

All works fine.

RE: Code Review Plugin - Added by Thomas M over 5 years ago

On my side all created review are always linking to the same file that is from another repository.
Nevertheless they seem to be recorded fine : if I open the diff back the comment is placed correctly.

RE: Code Review Plugin - Added by Haruyuki Iida over 5 years ago

Thomas M wrote:

On my side all created review are always linking to the same file that is from another repository.
Nevertheless they seem to be recorded fine : if I open the diff back the comment is placed correctly.

Thanks.
I changed the way reading repository data with redmine_code_review-0.1.3.1.
You can find it on http://code.google.com/p/r-labs/downloads/list

But I'm not sure it solve your problem.
Could you try it and inform me does it works or not?

RE: Code Review Plugin - Added by Thomas M over 5 years ago

Hi Haru,
I'm still having the same behaviour, sorry.

RE: Code Review Plugin - Added by Muhamed niyas over 5 years ago

Haru Iida wrote:

Hi. Let me announce to you My "Code Review Plugin" .It makes you can write code reviews of committed source code on Redmine's "Diff" page of repository browser.

like this...

Adding review.

Showing reviews.

I tested this plugin on Redmine 0.8.3 and current trunk.
I hope you will like this plugin. Thanks.

I got this error.

 ActiveRecord::RecordNotFound in Code_review#index

Showing code_review/index.html.erb where line #79 raised:

Couldn't find Change with ID=4

Extracted source (around line #79):

76:         </td>
77:         <td colspan="2" class="path">
78:           <%
79:             codepath = review.path
80:             if (review.path.length > 55)
81:               codepath = review.path[0, 15] + '...' + review.path[review.path.length - 35, 35]
82:             end

can you help me to fix this issue?

1 2 3 ... 5 (1-25/118)