Openzeppelin-contracts: Style guide says 4 spaces, yet you use 2. Not Documented

Created on 8 Oct 2018  路  4Comments  路  Source: OpenZeppelin/openzeppelin-contracts

Style guide says 4 spaces, yet you use 2.
https://github.com/OpenZeppelin/openzeppelin-solidity/blob/f7e53d90fa638553ffc93e93fe1b12fc081bb774/.soliumrc.json#L7

Not Documented here as to why:
https://github.com/OpenZeppelin/openzeppelin-solidity/blob/master/CODE_STYLE.md
If fact you state your follow the style guide.

馃捇 Environment

VS Code

馃摑 Details

Very painful and time consuming to refactor code to meet your standards (for PR) when the style guide suggests 4 spaces vs only 2. The standard among the majority of any language is typically 4.

馃敘 Code to reproduce bug

Solidity Linter in VS Code - yarn lint

bug documentation

Most helpful comment

After some discussion with @frangio, we've decided to migrate to 4 spaces, since interoperability with tools/other projects is more important than our personal preferences. Thanks @mswezey23, @LogvinovLeon, @treeder and @kabl for pushing for this!

All 4 comments

Hey there @mswezey23!

This has already been brought up a couple times (e.g. https://github.com/OpenZeppelin/openzeppelin-solidity/issues/152), I quote my thoughts from that issue:

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.

You are right in that this is not documented in the style guide, as it should (@elopio could you take care of this?). We do haver our linter set up to enforce this, though.

I'm surprised however that you find it time consuming to refactor code with 4 spaces, I'd expect most editors to be able to handle this automatically.

I'll have to check my setup, but attempting to have it auto refactor was not having the desired impact.

Question: What is the majority of the Solidity community utilizing? 4 or 2 spaces? Does it makes sense to go against the standard or the majority in this instance?

Side note: I'm not HUGE in the JS community (coming more so from a C#/Java background) . Given that, 2 spaces being the standard is news to me 馃ぃ

If the push is for 2 spaces, which it sounds like from thread you posted earlier, is there any active movement or effort to get this adopted by the style guide?

After some discussion with @frangio, we've decided to migrate to 4 spaces, since interoperability with tools/other projects is more important than our personal preferences. Thanks @mswezey23, @LogvinovLeon, @treeder and @kabl for pushing for this!

Ah! :) This makes me so happy

Thanks for the update @nventuro!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mswezey23 picture mswezey23  路  3Comments

nventuro picture nventuro  路  4Comments

sanchaymittal picture sanchaymittal  路  4Comments

bh2smith picture bh2smith  路  4Comments

bsadeh picture bsadeh  路  4Comments