Page MenuHomePhabricator

Autofix for switch indentation adds indentation to the wrong places
Closed, ResolvedPublicBUG REPORT

Description

See
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CentralAuth/+/637227/1/includes/specials/SpecialCentralAutoLogin.php
https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CategoryWatch/+/637226/1/src/Hook.php

The actual case statements and everything within them should be indented, or nothing should be changed, but just indenting the return/break statements is wrong

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
DannyS712 changed the subtype of this task from "Task" to "Bug Report".Oct 29 2020, 6:50 AM
DannyS712 moved this task from Unsorted to Reports on the User-DannyS712 board.

Shall we revert the switch indent fixer for now and do a new release? Or can it be fixed quickly?

I vote for disabling it. It appears like we might need to rewrite the entire sniff. Let's not rush but take our time to do this right.

Change 637062 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/tools/codesniffer@master] Revert "Add PSR2.ControlStructures.SwitchDeclaration"

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

Gave a +2 for the revert
Does this warrant releasing 32.0.1 (or 32.1.0)?

Change 637062 merged by jenkins-bot:
[mediawiki/tools/codesniffer@master] Revert "Add PSR2.ControlStructures.SwitchDeclaration"

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

Change 637591 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/tools/codesniffer@master] Release v33.0.0

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

Change 637591 merged by jenkins-bot:
[mediawiki/tools/codesniffer@master] Release v33.0.0

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

Fixed upstream, should be included on next release.

The fix is now part of phpcs3.6.0, which gets updated in mediawiki-codesniffer with https://gerrit.wikimedia.org/r/c/mediawiki/tools/codesniffer/+/678211

If this be readded or other handling should be done, it could be base on that. Maybe T182546 can get fixed than.