Page MenuHomePhabricator

Re-enable codesniffer sniffs disabled in TextExtracts
Closed, ResolvedPublic2 Story Points

Description

PHPCodeSniffer helps us stick to same coding standards across MediaWiki and it's extensions. Currently TextExtracts phpcs config differs from the MediaWiki one - the following sniffs are disabled:

MediaWiki.Commenting.FunctionComment.MissingParamComment
MediaWiki.Commenting.FunctionComment.MissingParamTag
MediaWiki.Commenting.FunctionComment.MissingReturn
MediaWiki.Commenting.FunctionComment.ParamNameNoMatch
MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic
MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName
MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment

Runing phpcs without those sniffs gives 24 errors and 9 warnings in 4 files.

Plan (YMMV)

  • 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.

Developer Notes

CodeSniffer output: P5743

Event Timeline

pmiazga created this task.Jul 13 2017, 2:44 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 13 2017, 2:44 PM
Jdlrobson triaged this task as Low priority.Jul 13 2017, 4:11 PM
Jdlrobson raised the priority of this task from Low to Normal.Aug 17 2017, 3:09 PM
Jdlrobson moved this task from Triaged but Future to Upcoming on the Readers-Web-Backlog board.
Niedzielski added a subscriber: Niedzielski.

The sniffs disabled appeared to be documentation or style-specific so I'm marking this easy. Please revert if you disagree.

Restricted Application added a subscriber: TerraCodes. · View Herald TranscriptOct 11 2017, 2:05 PM
Jdlrobson set the point value for this task to 2.Oct 11 2017, 4:45 PM
phuedx updated the task description. (Show Details)Oct 11 2017, 4:45 PM
phuedx added a subscriber: phuedx.
Aklapper updated the task description. (Show Details)Nov 20 2017, 10:47 PM

@Jdlrobson: Any guestimation into how many Google-Code-in-2017 tasks this ticket should be broken down ("about 2-3 hours for an experienced contributor")? And explicitly asking: Do you plan to mentor these?

Aklapper updated the task description. (Show Details)Nov 20 2017, 11:06 PM

@Aklapper one 2 hour task should be enough and contributor doesn't need to be experienced - just needs to know how phpcs works. Yes I can mentor.

Change 394232 had a related patch set uploaded (by Pppery; owner: Pppery):
[mediawiki/extensions/TextExtracts@master] Re-enable MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment sniff

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

Pppery claimed this task.Nov 30 2017, 1:57 AM

Change 394238 had a related patch set uploaded (by Pppery; owner: Pppery):
[mediawiki/extensions/TextExtracts@master] Re-enable MediaWiki.Commenting.FunctionComment.MissingParamComment sniff

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

Change 394240 had a related patch set uploaded (by Pppery; owner: Pppery):
[mediawiki/extensions/TextExtracts@master] Re-enable MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic sniff

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

Change 394238 merged by jenkins-bot:
[mediawiki/extensions/TextExtracts@master] Re-enable MediaWiki.Commenting.FunctionComment.MissingParamComment sniff

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

Change 394232 merged by jenkins-bot:
[mediawiki/extensions/TextExtracts@master] Re-enable MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment sniff

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

Jdlrobson closed this task as Resolved.Nov 30 2017, 10:28 PM

@pmiazga I'm resolving this as this looks to be done. Can you take a quick look when you have a chance just in case? Thanks @Pppery for taking care of this!

Change 394240 merged by jenkins-bot:
[mediawiki/extensions/TextExtracts@master] Re-enable MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic sniff

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