cozy-labs / cozy-light

Personal Server Made Easy
http://cozy-labs.github.io/cozy-light/
GNU Affero General Public License v3.0
104 stars 13 forks source link

coding style: early exit vs deep nested. #84

Open simpzan opened 9 years ago

simpzan commented 9 years ago

I like the idea of the project, and wanna join to make a little contribution. before that, I need to understand the code, so I start to read the code. I found that the coding style of deeply nested if statement is kinda hard to read. I think early exit is much more readable. Would you consider to make a switch of the style? https://en.wikibooks.org/wiki/Computer_Programming/Coding_Style/Minimize_nesting

frankrousseau commented 9 years ago

Hello @simpzan,

Thank you for your message. It's great you want to contribute and any help would be welcome.

About nesting code style, it adds a lot of readability by adding meaningful blocks. So we won't change it. The only things that could be used to simplifiy is the return callback(err); at the beginning of each callback functions.