@mnapoli opened this Issue on June 25th 2015 Contributor

I'm not sure it's covered by #8211 so here is a small issue to decide this: Piwik's codebase has inconsistent indentation accross languages. PHP is always 4 spaces (as per PSR-2), Javascript too IIRC, but Less/CSS and sometimes JSON are often a mix of 2 and 4 spaces.

How about we say it's 4 spaces for everything and be done with it? Anybody against that?

@tsteur commented on June 25th 2015 Owner

Personally I prefer 2 spaces in less/css files as it is much easier to read IMO. Same for JSON files.

@mnapoli commented on June 26th 2015 Contributor

Standards are not really meant to satisfy personal preferences. We don't use PSR-2 because we think it looks good, but rather because it's simpler for everybody and it's consistent with the rest of the PHP world. Simple and consistency are good for the project (a good illustration is how the indentation is all mixed up today), that's why I'm suggesting this change (not because I like it better with 4 spaces).

@tsteur commented on June 28th 2015 Owner

You asked, so I answered my opinion on that. Standards are good and important, but JSON/less is not PHP and if something is easier readable for a special purpose it can be ok to not follow standards. We spent most of our time reading code so it's quite important. I'm not saying I'm not ok with 4 spaces, just saying what I prefer.

@mattab commented on July 15th 2015 Owner

@tsteur because most of our less files already use 4 spaces, it would be nice to use 4 spaces for less files (this avoids having to screw all the git history if we changed it to 2 spaces...)

Anyway, we don't need to force space count for less or json - we could just keep standards for javascript and php for now since that's the core of our codebase?

@tsteur commented on July 15th 2015 Owner

I really do not care whether it's 4 or 2 spaces. Just personally think 2 spaces are for me better to read, at least for me. I do not work so often with it anyway so do not even mind if it is mixed with 2 or 4 spaces :)

@diosmosis commented on July 15th 2015 Member

:+1: for consistent indentation across all code files (.php, .less, .css, .html, etc.)

@mattab commented on January 18th 2016 Owner

Closing - this may be applied in the follow up issue Automatically convert our code base to use a consistent code style #9545

@tsteur commented on January 18th 2016 Owner

Just FYI: There is eg the JavaScript coding standard that uses 2 spaces https://github.com/feross/standard

This Issue was closed on January 18th 2016
Powered by GitHub Issue Mirror