Page MenuHomePhabricator

Fix codesniffer sniffs disabled with the update to 0.9
Closed, ResolvedPublic2 Story Points

Description

Codesniffer helps us write better code, that's better documented. Right now we're not reaping its full benefits.

From build: Updating mediawiki/mediawiki-codesniffer to 0.9.0

The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.Commenting.FunctionComment.MissingReturn
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch
* MediaWiki.FunctionComment.Missing.Public
* MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment

Plan (YMMV)

  • Enable sniffs one by one and send patches fixing the problems

AC

  • As many of the sniffs are made to pass as is possible.
  • If a sniff can't be made to pass for some reason, then document it as close as possible to the line disabling the sniff.

Developer notes

The latest version fo mediawiki-codesniffer is 0.10.0 -> it would be nice to update and verify everything works on latest code sniffer

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 20 2017, 10:53 AM
ovasileva moved this task from Backlog to Next Up on the Page-Previews board.
Jdlrobson triaged this task as Normal priority.Jun 20 2017, 4:05 PM
Jdlrobson added a project: good first bug.
Restricted Application added a subscriber: TerraCodes. · View Herald TranscriptJun 20 2017, 4:05 PM
Jdlrobson renamed this task from Fix codesniffer sniffs disabled with the udpate to 0.9 to Fix codesniffer sniffs disabled with the update to 0.9.Jun 21 2017, 6:54 PM
Jdlrobson lowered the priority of this task from Normal to Low.
Jdlrobson added a project: patch-welcome.
Jdlrobson updated the task description. (Show Details)
Jdlrobson raised the priority of this task from Low to Normal.Jun 28 2017, 6:50 PM
Jdlrobson added a subscriber: Jdlrobson.

bumping visibility

phuedx updated the task description. (Show Details)Jul 5 2017, 12:54 PM
pmiazga updated the task description. (Show Details)Jul 12 2017, 5:25 PM
Jdlrobson set the point value for this task to 2.Jul 12 2017, 5:26 PM
pmiazga updated the task description. (Show Details)Jul 12 2017, 5:27 PM
pmiazga claimed this task.Jul 12 2017, 7:50 PM

I'm picking this task as a time-filler for today

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

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

Change 364845 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/extensions/Popups@master] Re-enable MediaWiki.Commenting.FunctionComment.MissingParamTag sniff

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

Change 364846 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/extensions/Popups@master] Re-enable MediaWiki.Commenting.FunctionComment.MissingReturn sniff

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

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

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

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

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

pmiazga updated the task description. (Show Details)Jul 12 2017, 8:58 PM
pmiazga moved this task from Doing to Needs Code Review on the Readers-Web-Kanbanana-Board-Old board.

Many different extensions (MobileFrontend, TextExtracts, Popups) have many disabled sniffs. Some extensions (BetaFeatures, PageImages) do not have phpcs config at all. I'll create tasks accordingly as it's too much work to fix everything in this task.

I'll also bind this task with T162936 as it is improving developer happiness.

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

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

Change 364845 merged by jenkins-bot:
[mediawiki/extensions/Popups@master] Re-enable MediaWiki.Commenting.FunctionComment.MissingParamTag sniff

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

Many different extensions (MobileFrontend, TextExtracts, Popups) have many disabled sniffs. Some extensions (BetaFeatures, PageImages) do not have phpcs config at all. I'll create tasks accordingly as it's too much work to fix everything in this task.

Good idea. I also thought this task was only about page previews.

@bmansurov - you're right, in this task we had to fix PagePreviews code. I decided to check other extensions as fixing those could be quick and simple (this task took me less than an hour), but for an example, only MobileFrontend validation returned over 100 errors (I didn't count them but it was lots of scrolling ).

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

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

Change 364846 merged by jenkins-bot:
[mediawiki/extensions/Popups@master] Re-enable MediaWiki.Commenting.FunctionComment.MissingReturn sniff

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

Looks like https://gerrit.wikimedia.org/r/364850 is the only remaining patch and it needs a rebase?

@Jdlrobson : rebased. And yes, it was the only remaining patch.

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

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

phuedx removed pmiazga as the assignee of this task.Jul 14 2017, 8:42 AM
phuedx added subscribers: pmiazga, phuedx.

This task needs a Signer Offerer.

Jdlrobson closed this task as Resolved.Jul 14 2017, 11:44 PM
Jdlrobson claimed this task.

That will be me :)