turboladen / tailor

A RubyGem that allows for checking standard styling of Ruby files.
146 stars 18 forks source link

Proper Indentation #86

Closed jcasimir closed 12 years ago

jcasimir commented 12 years ago

Hey all,

I would be super excited if tailor could detect proper indentation of code, not just tabs/spaces. When I teach Ruby, some people really struggle with getting the indentation right. Having an automated check would be super helpful.

This would be useful enough that I'd sponsor a small bounty for your effort.

turboladen commented 12 years ago

Thanks for the request, Jeff. Indentation checking is at the top of my list for tailor.

This indentation thing is actually the main reason why I slowed on adding new features to tailor in 2010. I realized the existing design wasn't going to make it very easy to implement indentation checking; I realized I should probably check in to source parsers (instead of insane RegExps) to make this happen. After lots of off & on research, about a month ago, I decided to rewrite tailor from scratch using Ripper, which has allowed me to make some headway on solving the indentation problem.

I've got these changes in https://github.com/turboladen/tailor/tree/ripper. I think right now this branch will detect indentation OK, as long as your file(s) don't use any keywords as statement modifiers (if, unless, until, etc. Normal if/unless statements should be fine.), although I have quite a few tests to write to prove it out. Since I started the rewrite with the intent of solving the indent checking first, this tailor only does indentation checking right now.

This branch is definitely way early development, but I'm hoping to continue on in seeing if I can get a reasonable solution for detecting indentation, plus add back the existing features, in the next couple of months. A small bounty could certainly help speed that up, since this is a "fun time" project for me… :) PM me with what you're thinking about!

Thanks again for the request… I'll post any significant updates to the ripper branch here, just in case they could prove of some use.

On Feb 23, 2012, at 11:46 AM, Jeff Casimir wrote:

Hey all,

I would be super excited if tailor could detect proper indentation of code, not just tabs/spaces. When I teach Ruby, some people really struggle with getting the indentation right. Having an automated check would be super helpful.

This would be useful enough that I'd sponsor a small bounty for your effort.

  • Jeff

Reply to this email directly or view it on GitHub: https://github.com/turboladen/tailor/issues/86

jcasimir commented 12 years ago

I guess github got rid of of PMs...or I can't find them anymore. Throw me your email address at jeff at jumpstartlab com

turboladen commented 12 years ago

Implemented as of fae9b6fc2b696270ae6b886374a189771cadfb45