yaaase / stylr

ruby styleguide enforcer
MIT License
3 stars 0 forks source link

stylr

a Ruby styleguide enforcer

Build Status Dependency Status

This gem will check if source code conforms to some elements of the Github Ruby Style Guidelines (https://github.com/styleguide/ruby) - currently supporting Ruby 2.1.0, but should support 1.9.3 and up (stylr uses the Ripper found in 1.9.3+; in 1.8.7, Ripper has been backported here). Obviously it does not check against the subjective elements of the styleguide.

Kind of raw still. Currently supports checking against the following:

Optionally checks for some metaprogramming, which you might not want in a large, enterprise codebase with varied levels of skill on your development team. This is not a condemnation of these practices - most of them are good, idiomatic Ruby. You might not, however, want your junior developers checking in lots of metaprogrammed code. Pass the '--meta' flag to enable these checks.

All of these things are configurable via yml. See "stylr.yml" in the repo. Whatever directory you run stylr from will look for stylr.yml.

Checks all *.rb files in the specified directory and subdirectories, excluding _spec.rb and _test.rb

Usage

gem install stylr

stylr /path/to/directory normal checks

stylr /path/to/directory --meta also check for use of metaprogramming

stylr /path/to/directory --ignore=dir_to_ignore optionally ignore a particular directory relative to the current directory

Here's what Rake uses to check against the stylr source itself with (launched from the stylr root dir):

stylr . --ignore=spec --ignore=vendor

Contributing

Please feel free to contribute! There are issues and unimplemented features. I'd love any help I can get. Thanks!