Page MenuHomePhabricator

Fix up PHPCS violations that are excluded in .phpcs.xml
Open, Needs TriagePublic

Description

PHPCodeSniffer helps us stick to same coding standards across MediaWiki and its extensions.
In MediaWiki core and various MW extensions, we have PHP CS rules in a file called .phpcs.xml that are excluded because the code repository has various violations. In most cases, these can't be fixed automatically.

Remove a sniff from the .phpcs.xml file, run composer phpcs or phpcs -p -s, get a list of violations, provide patches in Wikimedia Gerrit to fix the violations. If you fix all violations for one sniff, also commit the removal of the exclusion from .phpcs.xml too.

Fix some (define a number here?) of these up.

https://tools.wmflabs.org/phpcs/

Event Timeline

That could be a subtask of this, though this was designed as a GCI task specifically

I think 5-10 changes should be reasonable, wouldn't it? @Reedy Do you want to mentor this task together with me? :D

You mean, 5-10 separate changes?

Also see existing subtasks (especially for improving the task description). To get a list of excluded sniffs per MediaWiki extension repository:
find /home/user/git/mw/extensions/ -type f -name "*phpcs.xml" -printf "%h\n" -execdir grep -H '<exclude name=' '{}' +

You mean, 5-10 separate changes?

No, I mean 5-10 modified things inside one change to complete :) Sorry for the confusion.

Given the amount of work we've asked for in the existing 2 or 3 subtasks already I'd put that higher than 5-10.

Samwilson renamed this task from Fix up PHPCS violations that are excluded in phpcs.xml to Fix up PHPCS violations that are excluded in .phpcs.xml.Jun 6 2018, 11:28 PM

Change 437660 had a related patch set uploaded (by Samwilson; owner: Samwilson):
[mediawiki/extensions/PageTriage@master] Namespace classes and give each its own file

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

Change 437660 merged by jenkins-bot:
[mediawiki/extensions/PageTriage@master] Namespace classes and give each its own file

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

Change 466839 had a related patch set uploaded (by Samwilson; owner: Samwilson):
[mediawiki/extensions/Cargo@master] Remove ParamNameNoMatch phpcs sniff and fix errors

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

Change 466839 merged by jenkins-bot:
[mediawiki/extensions/Cargo@master] Remove ParamNameNoMatch phpcs sniff and fix errors

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