Railscheck

- The semi-static Q/A verification tool for your Ruby on Rails projects

This project is (or will be) a best effort semi-static verifier for your Ruby on Rails projects. Delivered as a Ruby gem it provides a shell command task "railscheck" that you can run against your Rails projects to test for a number of typical bugs, potential problems and inconsistencies.

It is a law of software development that the earlier you identify a problem the cheaper it is to fix. This project aims to help you quickly identify quality assurance problems as early as possible (thus avoiding unnecessary debugging work for you and your development team ; as well as avoiding unnecessary, negative "surprises" for your users)... And best of all, it is all done automatically for you - no extra work required!

Project site and detailed information

This project is hosted on http://rubyforge.org/projects/railscheck/. Refer to the latest README for up-to-date information on this gem or to the online RDoc's for code details. See also the blog 41 tecnologies for occasional postings about Railscheck.

Featured checks

Syntax check and validation of (static files):

Database:

Models:

Warnings and deprecations :

Overall :

Installation

This project is hosted on rubyforge. Install latest version using the gem command (sudo part is for linux/unix/mac os only - omit for Windows):
sudo gem install railscheck

Running

Note: Before running railscheck do make sure this gem is installed, your project is configured and that all your migrations are run for the project(s) you want to check.

Full usage instructions including useful details about including/excluding individual checks:
railscheck -h
Check your project using all build-in checks:
$ railscheck /mypath/myrailsproject
Railscheck 0.2.0 (nb. help & more information avilable with -h argument):
Booted RoR 2.0.2 project at "/mypath/myrailsproject".
Running all railscheck tests satisfying /.*/  and not satisfying /html/:
Loading test file "./../lib/test/tc_config.rb".
Loading test file "./../lib/test/tc_database.rb".
Loading test file "./../lib/test/tc_models.rb".
Loading test file "./../lib/test/tc_project.rb".
Loading test file "./../lib/test/tc_rails_deprecations.rb".
Loading test file "./../lib/test/tc_syntax_check_ruby.rb".
Loading test file "./../lib/test/tc_views.rb".
Loading test file "./../lib/test/tc_xml.rb".
Loading test file "./../lib/test/html_and_css.rb".
Loaded suite ./railscheck
Started
..............
Finished in 0.352005 seconds.

14 tests, 61 assertions, 0 failures, 0 errors
Note: The above project has no problems - what about your project?

Implementation details and how to contribute

You can easily add your own checks to the "lib\test" folder. Checks are tests based on the standard ruby unit test framework and following the standard conventions they should be placed in Ruby files starting with "tc_" in order to be picked up by Railscheck automatically. All test classes should inherit from Railscheck::TestCase which in turns inherits from Test::Unit::TestCase. See the existing test files for examples.

Any added code that you contribute will be given due credit! However make sure that you assign undersigned shared copyright so I am allowed to release and license your work together with this project.

The source code is available anonymously (readonly) using subversion:
svn checkout svn://rubyforge.org/var/svn/railscheck/trunk

Once you have added your tests write undersigned an email in order to get registered and get your contribution into Railscheck. When you are registered as a project contributor you may access the source code from subversion with full read/write rights using:

svn checkout svn+ssh://YOUR-RUBYFORGE-LOGIN-NAME@rubyforge.org/var/svn/railscheck/trunk

Authors

  1. Morten Christensen, senior consultant, software developer from Danish software development/consultancy company 41concepts. (see also our R&D blog).

Special credits

  1. Dr Nic Williams for the newgem tool and basic css design of website (with theme extended from Paul Battley)
  2. Fail Early and MySQL driver Tasks written by Mike Naberezny for Advanced Rail Recipes etc.
  3. DZone Snippet Rails task to find code typos in rhtml templates by Dmitry Severin (dseverin)
  4. Rails 2.0 deprecations snippet by Mislav Marohnic
  5. Rails deprecations plugin by Geoffrey Grosenbach
  6. Aaron Patterson for the Johnson javascript gem used for javascript validation.
  7. Alex Dunae for the W3C wrapper gem used for CSS/(X)HTML validation.

License:

This software is FREE for both public and commercial use - with the possible exception of commercial software development tool makers that may require a license (see project license file for details).