Coding style guidelines

Matt Wagner matt.wagner at redhat.com
Thu Apr 26 16:16:00 UTC 2012


On Thu, Apr 26, 2012 at 06:02:00PM +0200, Michal Fojtik wrote:
> On 04/26/12, Maros Zatko wrote:
> > Hi everybody,
> > 
> > I'd love to ask you if we have some coding style guidelines.
> > If we don't I'd like to propose creating such thing and start to
> > enforce it in a review process.
> 
> Actually it's not bad idea to have some coding/style guidelines in place.
> If all people adopt them and use them, then the resulting project codebase
> will look more consistent.
> 
> I want to propose this: https://github.com/bbatsov/ruby-style-guide for the
> general discussion :-)

Yes! That's the resource I was thinking of.

This reminds me of one thing I've seen us do inconsistently --
parenthesis for arguments where they're not strictly required.

For example, I prefer:
  user.update_attribute(:foo, 'bar')

But this is also totally valid:
  user.update_attribute :foo, 'bar'

It seems that some people try to always use the parens, some try to
never use them, and some (AFAICT) prefer to use them only when there is
more than one argument. The linked style guide suggests using them when
they are part of an internal DSL or considered "keywords" or accessor
methods, but all other method invocations should use parens. I don't
feel too strongly, except that consistency is nice.

-- Matt



More information about the aeolus-devel mailing list