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/

Details

Related Gerrit Patches:
mediawiki/extensions/Cargo : masterRemove ParamNameNoMatch phpcs sniff and fix errors
mediawiki/extensions/PageTriage : masterNamespace classes and give each its own file

Event Timeline

Reedy created this task.Oct 10 2017, 1:07 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 10 2017, 1:07 AM
Reedy added a comment.EditedOct 18 2017, 4:46 AM

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

Aklapper updated the task description. (Show Details)

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

Legoktm updated the task description. (Show Details)Aug 19 2018, 7:12 AM

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