DRY
At last, my first Rails plugin!
- generates a report of duplicate lines in your code to help you to follow the DRY principle
- integrates with :
# With RSpec
it { rails_application.
with_threshold_of_duplicate_lines(4).
should be_DRY }
# With Test::Unit
assert_DRY(ruby_code_in_rails_plugin("dont_repeat_yourself"))
To start playing:
ruby script/plugin install http://dryplugin.rubyforge.org/svn/vendor/plugins/dont_repeat_yourself/
rake dry:report:html
or rake dry:report:textmate if you're an happy mac user
If you want to contribute, please use the git repository:
http://github.com/garnierjm/dry-report/tree/master/rails_plugin/vendor/plugins/dont_repeat_yourself/
The doc:
- Read the README
- View the 1 min amateur screencast of the Netbeans integration
- Examples of unit test helpers coming soon, for now look at spec/rspec_custom_expectation_matchers_spec.rb and spec/test_unit_extension_spec.rb
Your FeedBACK is more than welcome! Post a comment in this blog or contact me
Cool DRY logo by CodeSmack (Please send me the t-shirt guys!)
Based on Simian (Similarity Analyser) by Simon Harris from RedHill Consulting, see http://www.redhillconsulting.com.au/products/simian/
Copyright (c) 2003-08 RedHill Consulting Pty. Ltd. All rights reserved.
1 comment:
Very interesting project! A bit depressing to run it on my current project, but that's the point I suppose...
Since I have a Mac I tried out the textmate formatter. The links (txmt://...) work as expected - they take me to the current line. However, it would probably be more useful if I were able to run the reports from within Textmate - for instance in the form of a Textmate bundle. (Bundles->DRY->display report for [current project|selected files], for instance). I think it would be easier to get started using this if it were possible to run it on a couple of files where I suspect there is duplication.
Have you considered distributing this as a gem instead of a plugin? Any plans of making the source available thru git? That could make it easier to contribute stuff, for instance for a Textmate bundle...
Post a Comment