Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code style: consistent indentation with 4 spaces everywhere #8212

Closed
mnapoli opened this issue Jun 25, 2015 · 8 comments
Closed

Code style: consistent indentation with 4 spaces everywhere #8212

mnapoli opened this issue Jun 25, 2015 · 8 comments
Labels
answered For when a question was asked and we referred to forum or answered it. duplicate For issues that already existed in our issue tracker and were reported previously. RFC Indicates the issue is a request for comments where the author is looking for feedback.

Comments

@mnapoli
Copy link
Contributor

mnapoli commented Jun 25, 2015

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?

@mnapoli mnapoli added the RFC Indicates the issue is a request for comments where the author is looking for feedback. label Jun 25, 2015
@mnapoli mnapoli added this to the Short term milestone Jun 25, 2015
@tsteur
Copy link
Member

tsteur commented Jun 25, 2015

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

@mnapoli
Copy link
Contributor Author

mnapoli commented Jun 26, 2015

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
Copy link
Member

tsteur commented Jun 28, 2015

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
Copy link
Member

mattab commented Jul 15, 2015

@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
Copy link
Member

tsteur commented Jul 15, 2015

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
Copy link
Member

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

@mattab
Copy link
Member

mattab commented Jan 18, 2016

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

@mattab mattab closed this as completed Jan 18, 2016
@mattab mattab added duplicate For issues that already existed in our issue tracker and were reported previously. answered For when a question was asked and we referred to forum or answered it. labels Jan 18, 2016
@tsteur
Copy link
Member

tsteur commented Jan 18, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it. duplicate For issues that already existed in our issue tracker and were reported previously. RFC Indicates the issue is a request for comments where the author is looking for feedback.
Projects
None yet
Development

No branches or pull requests

4 participants