User:Lethexie/GSoC2016 Final Evaluation Report
Finally, the project "Improving static analysis tools for MediaWiki" is approaching its end. I feel happy to work with Mediawiki and really enjoy coding this summer. Let's begin with accounting goals and achievements in the project. All of my contributions to the project could be found here.
Forbidding illegal format of inline comments like /*** fail ***/
In this sniff, it forbids illegal inline comments that use multiple asterisks (amount >= 2) and give a warning, with auto fix capability. The commit information is provided here: https://gerrit.wikimedia.org/r/292313
Unexpected empty line shows up after fixing the open brace of a function
This sniff fix a bug that cause a empty line added to the start of a function when phpcbf try to automatically change the brace-opening style. The commit information is provided here: https://gerrit.wikimedia.org/r/293966
A newline expected before a single line comment
To conform to the coding standards that states "an inline comment should start with a new line", this sniff automatically detect codes that against the specification, and give out warnings. This sniff provide capability of automatic fixing through phpcbf. The commit information is provided here: https://gerrit.wikimedia.org/r/295901
Brace should be placed on the same line as the start of class
This sniff unify the open brace location of a class. According to Mediawiki's coding standards, the open brace should be placed in the same line with the class declaration. It provides capability of automatic fixing through phpcbf. The commit information is provided here: https://gerrit.wikimedia.org/r/297355
Using globals ($wgUser, $wgRequest) when their context equivalents could be used instead ($this->getUser(), $this->getRequest())
This sniff enforce all subclasses that derived from ContextSource to use the context equivalents like $this->getUser() than the global functions like $wgUser (except the static member functions). The commit information is provided here: https://gerrit.wikimedia.org/r/301335
Using wfMessage() when $this->msg() is usable
This sniff perform the same kind of check on the codebase as the 5. The commit information is provided here: https://gerrit.wikimedia.org/r/301335
Add function comments
This sniff enforce every functions to have a document comment. The commit information is provided here: https://gerrit.wikimedia.org/r/291489
Check if the code use PHP superglobals (like $_GET, $_POST, etc)
This sniff warn codes that use PHP superglobals like $_GET and $_POST, etc. According to Mediawiki's coding standards, accessing PHP superglobals is illegal. The commit information is provided here: https://gerrit.wikimedia.org/r/296395
Job That Are Abandoned
Avoid to use PHP deprecated classes, functions and variables
The major reason for abandoning this task is PHP is providing deprecation warnings itself even if the code is analyzing by PHPCodesniffer. So we agree that this task is no longer needed thus abandon it.
What To Do Next
After the GSoC, I will continue working with Mediawiki developers to:
- work on the passed commits
- solve problems feedback from other developers
Also, there's a task was not accomplished in a perfect way: Usage of $dbr->query() directly instead of the $dbr->select() wrapper.
This sniff warn the codes that access database through calling $dbr->query() instead of $dbr->select(). However, some special cases revealed when we test on it. Some code use $dbr->query() to fetch database status data may have to use $dbr->query(), as the case https://github.com/wikimedia/mediawiki/blob/master/includes/search/SearchMySQL.php#L438-L441 shown. We need working on these exceptions later. The commit information is provided here: https://gerrit.wikimedia.org/r/301364
During the project development process, my mentor @EBernardson and @Legoktm has helped me a lot. Very appreciated! I will keep working with Mediawiki, and contribute to open source.