Page MenuHomePhabricator

Add sniff to avoid if/else/while/foreach without curly braces
Closed, ResolvedPublic

Description

There is no sniff which enforce use of { and } for if/foreach and so on as written in mediawiki code style

See https://gerrit.wikimedia.org/r/#/c/60199/1 for a possible implementation.

Details

Related Gerrit Patches:

Event Timeline

Umherirrender raised the priority of this task from to Needs Triage.
Umherirrender updated the task description. (Show Details)
Umherirrender added a subscriber: Umherirrender.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 26 2015, 8:45 PM

Change 241483 had a related patch set uploaded (by Legoktm):
Add Generic.ControlStructures.InlineControlStructure to ruleset

https://gerrit.wikimedia.org/r/241483

The test run against MediaWiki core found https://phabricator.wikimedia.org/diffusion/MW/browse/master/includes/SquidPurgeClient.php;19d5f55c010356ba1b29696bc566f1fc902fef4a$298 which is a bit weird since it doesn't have a body, but I think we don't want that right?

It is valid syntax, where phpcs should not add an error (In my opinion, see also the implementation of the linked change set in the bug description)

Change 241483 merged by jenkins-bot:
Add Generic.ControlStructures.InlineControlStructure to ruleset

https://gerrit.wikimedia.org/r/241483

This seems to be pushed to master - isn't this task complete ?

The sniff is in the repo, but it seems it is not used in mediawiki/core

Needs this a update of the codesniffer version in the dependency?

See https://gerrit.wikimedia.org/r/#/c/246184/ for a new issue

TasneemLo set Security to None.Dec 20 2015, 9:16 AM
TasneemLo removed a subscriber: TasneemLo.
Restricted Application added a subscriber: StudiesWorld. · View Herald TranscriptDec 20 2015, 9:16 AM
Krinkle triaged this task as Medium priority.Jul 27 2016, 12:48 AM
Legoktm closed this task as Resolved.Aug 27 2016, 1:49 AM
Legoktm claimed this task.