Openzeppelin-contracts: Use 4 spaces instead of 2

Created on 1 Mar 2017  路  13Comments  路  Source: OpenZeppelin/openzeppelin-contracts

Contribution guideline to this repo suggests using Solidity Style Guide https://github.com/ethereum/solidity/blob/develop/docs/style-guide.rst
It says, that one should use 4 spaces to indent.
All the contracts in this repo use 2 spaces. Probably we should change that?

Most helpful comment

But let's make a new vote.

React with :+1: to vote for 2-spaces, react with :smile: to vote for 4-spaces

All 13 comments

I personally don't agree with that style recommendation. What do other devs think? :+1: to vote for 2 spaces, :-1: to vote for 4 spaces.

closing after 7-1 voting result

Yes, I'm reviving a year old issue. 馃槈

All the linters default to 4 spaces because that's the Solidity guidelines, I think it would be better for everyone if you guys got on board the 4 space train. http://solidity.readthedocs.io/en/v0.4.24/style-guide.html

Strongly disagree :)

But let's make a new vote.

React with :+1: to vote for 2-spaces, react with :smile: to vote for 4-spaces

@maraoz based on what? Just personal preference? I like 2 spaces better too, but I also know that following community guidelines is better than my opinion.

This is what everyone sees by default when they use OZ contracts:

screen shot 2018-08-10 at 9 41 00 am

It's super easy to argue about code style. The solution to that is to follow the recommended practices of the language, and throw the discussion one level higher. So +1 to follow whatever the solidity devs recommend.

Maybe we should change the recommended style? :) After all, Solidity is supposed to be influenced by JavaScript (and there is a lot of JS around anyway due to tests, deployment scripts, etc.), where the 2 spaces convention is very widely extended.

@nventuro give it a try! 馃槂 But in the meantime...

4 spaces is just way too big, imo. I'd change the recommended value to 2 for the same reason everyone gave up on 4 spaces in javascript some time between 2014 and 2016.

@nventuro yup, this discussion should happen in the solidity repo, IMO.

I really don't care if it's two or four spaces. What I care is that when I download the tools and sources that they fit together without modification. - aka Interoperability.

Was this page helpful?
0 / 5 - 0 ratings