rails new --skip-comments

The first thing I do after generating a Rails app is remove the default code comments. I was having trouble finding a script to do this automatically, so I decided to make this. It’s super hacky and not recommended since it removes them after they’ve been added, but it gets the job done for now.

It would be cool to allow the user to skip generating the comments by adding a “–skip-comments” flag and by wrapping each comment in the template files:

<% unless skip_comments -%>


<% end -%>


But I can see how maintaining this could get out of hand, since each comment in a template would require this logic. An alternative would be using a similar approach to my method and removing them after they’ve been created, but this might cause issues in future Ruby versions and template changes.

You’ve probably already thought about this, but this would save me a lot of time so I want to make sure. :smiley:



I don’t think that this would be a good tradeoff, because it would introduce a lot of noise into the codebase. If those comments are really bothering you, you might achieve similar results with certain editors (search and replace maybe?).

In any case, the good news is that you only have to do it once.