- rEWBA8892ab4df043: JSCS: require space also after case, void, with, typeof
rEWBA6edf9cae0620: JSCS: requre space also after case, void, with, typeof
rEWBAcd178eebfa28: JSCS: require space also after case, void, with, typeof
rMEXT029bcdcb68ed: Updated mediawiki/extensions Project: mediawiki/extensions/Wikibase…
- Mentioned In
- rEWBAaaae4d51a7fa: build: Enable jscs jsDoc rule 'checkParamNames' and make pass
rMEXT6abecb91e072: Updated mediawiki/extensions Project: mediawiki/extensions/Wikibase…
rEWBA584bee54bf83: build: Enable jscs jsDoc rule 'requireReturnTypes' and make pass
rMEXT7a3f71ba3cdc: Updated mediawiki/extensions Project: mediawiki/extensions/Wikibase…
rEWBAfd0812c22a3b: build: Enable jscs jsDoc rule 'checkTypes' and make pass
rMEXTae30f929b00e: Updated mediawiki/extensions Project: mediawiki/extensions/Wikibase…
rMEXT0487a8aebd58: Updated mediawiki/extensions Project: mediawiki/extensions/Wikibase…
rEWBA7d7d74c5c619: Enable JSCS rule requireSpaceAfterKeywords in "google" style
Even if I agree with some details in https://gerrit.wikimedia.org/r/#/c/233934/ (and not with others), I do not want to comment on these details but instead I have to ask:
- Why was this added to the previous sprint?
- Why is this in the current sprint?
- Why do we want to change this? What are the benefits? What is the price? Is it worth it? Who decides if it is worth it?
Note that the code style we are messing around with here was intentionally created like that in November 2013. The team changed a lot since then and we may agree that this is reason enough to have this discussion.
This is what I would like to do:
function( param ) could be mistaken for a declaration of a function named "function".
MediaWiki core uses "function" + " " + function name + "(" ecc. and the name of an anonymous function is obviously empty. Also in PHP, because I can find much more occurrences of "function (" than "function(".
I don't feel strongly about the coding style change. In the long run it probably makes sense to have Wikibase PHP and Wikibase JS as well as Wikibase JS and MediaWiki JS follow the same coding style. I'm not looking forward to the merge conflicts this will give us, though.
What I find a good idea definitely is the suggestion by @Ricordisamoa to set up proper jscs rules for whatever conventions we end up using.
AFAIK the ticket was created based on a patch that was uploaded before the topic was discussed and by someone who was not aware of our Wikibase JS coding conventions. I get from the conversation on this ticket that for the JS developers there is actually no problem with sticking to that convention so I suggested to not waste more time on this topic for now.
Shall I abandon https://gerrit.wikimedia.org/r/233934 then?
In https://gerrit.wikimedia.org/r/242615 I collected a few more reasons for sticking with function():
- It's "official" in other JSCS presets, e.g. the "google" preset.
- JSCS itself uses the "google" preset.
- Even other big Wikimedia projects like Parsoid and Flow do it like we do.
- MediaWiki core's PHP uses a mixture of function() and function () with no clear preference and obviously no PHPCS set up to enforce anything. I find this relevant because I consider consistency across languages important.
For the record, this is what we decided to left out for now: