0.0
No commit activity in last 3 years
No release in over 3 years
Create Cane violations for pre-Ruby 1.9 hash syntax
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
>= 0

Runtime

>= 0
 Project Readme

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