cane-hashcheck
cane-hashcheck
enforces Ruby 1.9 hash syntax in your Ruby project using
cane.
Description
If you no longer like hash rockets, cane-hashcheck
is for you. For example,
see this ugliness?
# person.rb
def options
{
:name => 'Bob',
:age => 30,
:location => 'Seattle'
}
end
When we run our quality rake task, we are scolded for using the old hash syntax and encouraged to make a change on three lines:
$ rake quality
Ruby 1.9 hash syntax violation (3):
person.rb:3
person.rb:4
person.rb:5
Total Violations: 3
Ah, much better:
# person.rb
def options
{
name: 'Bob',
age: 30,
location: 'Seattle'
}
end
Usage
Add cane-hashcheck
to your project's Gemfile:
gem 'cane-hashcheck'
Use the Cane::HashCheck
in your quality rake task:
require 'cane/hashcheck'
desc 'Check code quality'
Cane::RakeTask.new(:quality) do |task|
task.use Cane::HashCheck
end
Check code quality using rake:
$ rake quality
See the cane project for general usage instructions.
Contributing
Please see the Contributing Document
Changelog
Please see the Changelog Document
License
Copyright (C) 2013 Chris Hunt, MIT License