Page MenuHomePhabricator

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


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

See for a possible implementation.

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.

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

The test run against MediaWiki core found;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

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 for a new issue

Krinkle triaged this task as Medium priority.Jul 27 2016, 12:48 AM
Legoktm claimed this task.