Page MenuHomePhabricator

MediaWiki Codesniffer not catching irrelevant characters after PHPDoc return types
Closed, ResolvedPublic

Description

This little thingy patch: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Popups/+/486294 reveals that CS for some reason doesn't catch trailing characters after the types for a PHPDoc @return annotation.

Cases like;

@return array/

should be caught by phpcs and make Jenkins to fail explicitly. @thiemowmde suggest we also tag this as good first task :)

Event Timeline

It is looking for punctations (regex class \p{P} which include \ when looking at https://www.fileformat.info/info/unicode/category/Po/list.htm

But this file is ending with 'Test.php' which is skipped in the FunctionComment sniff to avoid docs of test functions/classes

What documentation should a newbie read to learn how to do this? Oh, I guess I'll take a look at https://phabricator.wikimedia.org/project/profile/1087/ for inspiration.

Change 655188 had a related patch set uploaded (by Umherirrender; owner: Umherirrender):
[mediawiki/tools/codesniffer@master] Check @param/@return on files ending in Test.php

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

Change 655188 merged by jenkins-bot:
[mediawiki/tools/codesniffer@master] Check @param/@return on files ending in Test.php

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

Umherirrender claimed this task.

Should be catched also on tests after a new codesniffer release is applied to all extensions