Page MenuHomePhabricator

Outreachy proposal for : Improving static analysis tools for MediaWiki
Closed, DeclinedPublic

Description

Improving Static Analysis Tools for MediaWiki

Public URL - http://www.mediawiki.org/wiki/User:TasneemLo/Outreachy11-CodeSniffer

Related phabricator tasks - T89682 is the master task.

Project Outline

The most popular issues that come up in review are based on coding conventions - especially when a new user wants to contribute to the community. This can be addressed by a static code analysis tool which is able to identify these problems (without human intervention) and can let the contributor know the issues - or better yet solve it autonomously. PHP-CodeSniffer is one such tool which allows this.

PHPCS has already been added to the composer file in mediawiki-core (https://gerrit.wikimedia.org/r/#/c/183067/) and the core nearly passed the test using the custom standard for mediawiki (https://git.wikimedia.org/summary/mediawiki%2Ftools%2Fcodesniffer) is being worked on. This projects aims to improve on the custom standard and make it even better. This reduces the repetitive tasks that every reviewer has to do to check coding standards and also gives the contributor a quick way to correct it !

There are many avenues where the codesniffer can be improved:

  • Making mediawiki specific sniffs which are able to identify reasons why the patch-set should not be accepted.
  • Testing infrastructure for the codesniffer itself. (T92751, T108458)
  • Set-up CI on the core and all other extensions. Also enable phpcs in the composer files.

Of these, the first is the most important and the other two are smaller and easy to do (and already has patches). The first point is where I will be focusing on in my project. If time permits, I'll also work on the others.

Mentors: @Addshore, @EBernhardson

Communication

I will always try to stay logged into IRC (Channels MediaWiki-General, #mediawiki-dev, #wikimedia-tech and #wikimedia-releng during my working hours and will try to contribute back to the community as much as I can. I am extremely regular in replying to emails and also to comments on phabricator and gerrit (as they send notifications to my mail). I plan to prepare a weekly report of things done (as recommended in Outreach_programs/Lessons_learned) and send it over to my mentors and update it on this page in the ''Timeline'' section. All source code written by me will be regularly pushed to gerrit so that my mentors can review it when they're free. I will keep my mentors updated about the progress through what ever form of communication they prefer (Email or weekly IRC meetings). All discussions regarding design and implementation will be public :)

Time-line

Initial homework (Nov 17 - Dec 7)

This section encompasses work that will be done before the official coding period begins. Here, the major priority is to identify the sniffs to make during the project. Possible methods include:

  • Design and make a survey where people can describe what basic checks they do before accepting a patch. Also, float this survey on wikitech-I.
  • Go through recent patch sets and identify issues mentioned in the comments that can be checked using codesniffer (Maybe this could be automated ... but it seems troublesome with too many false positives/false negatives)
  • Find sources like https://github.com/wikimedia/mediawiki-tools-code-utils or https://github.com/squizlabs/PHP_CodeSniffer itself - which do similar static code analysis - and identify whether they can be implemented/modified for our case.
  • Figure out sniffs that can be made using the CHANGELOG between mediawiki versions.
  • Read through Manual:Coding conventions/PHP and identify any points that need more looking into. (I've already read this to a large extent.)

This would give a list of sniffs or at least a good idea on what sort of things can be done during the next phase of the project.

Week 1 (Dec 7 - Dec 13)

Here, I'd like to work on a secondary task where a patch has already been submitted by me - The testing infrastructure. Currently the testing infrastructure is not up to the mark, and I'd like to be able to fix this issue. Currently, integration tests are being done - and it is only checked whether a file passes the phpcs test or not. This is okay, but doesn't really test what is needed.

Things needed to be addressed:

  • The file may fail due to another sniff finding a fault - so, only the sniff being tested should be enabled.
  • It is not checked whether all the fail cases are actually failing - it is only seen whether the whole file is failing. Need to check which lines the failure is happening in.
  • Fix-its are not being tested at all, and currently it simply tests if issues have been found. An infrastructure for fix-it testing needs to be made.

Week 2 (Dec 14 - Dec 20)

During this week, I hope to complete the testing infrastructure mentioned above, move all existing tests to the new infrastructure, add new tests to test fix-its and push it to master.

Other than that the list found during the Initial work needs to be compiled from the survey and other sources and a priority order needs to be given.

Week 3 (Dec 21 - Dec 27) to Week 13 (Feb 29 - Mar 6)

This week, I plan to create phabricator tasks for the items found. Also, I will post all the data I found in a common space so that it can be used later also. The phabricator tasks will be refined form of the data so that even if I am unable to complete all of the things found, it can be taken up by others or myself after the Outreachy project.

Here, I begin making sniffs for each phabricator issue and test them on mediawiki-core or other mediawiki related code. Iterations to improve and fix any issues that come up will be needed.

This will be repeated for the rest of the project. I'll keep a deadline every two weeks to ensure all my sniffs until then have been merged.

Personal Information

Name - Tasneem Lohani
Email - tasneem.lo.31 [at] gmail.com
IRC Nick - TasneemLo
User Profile - https://www.mediawiki.org/wiki/User:TasneemLo
Timezone - UTC + 5:30 (IST - India)
Location - India
Typical working hours (Flexible to ensure deadlines are kept)

  • IST : 10am to 1pm and 3pm - 9pm
  • UTC : 4:30am to 7:30am and 9:30am - 3:30pm

About me

I'm a college student from India, and at my college I learn a lot of varied things. I've made and designed a few websites earlier and am familiar with PHP, JavaScript, HTML/CSS. I've also dabbled in android development (although I do not own an android phone right now). I have a very varied skill set and love doing things that interest me and make me learn new things. I've recently started contributing to open source software, and MediaWiki was the right fit for me as I'm well versed with web technologies.

Current experience with Mediawiki

  • Have set-up the development and debug environment on the core and mediawiki-codesniffer.
  • Basic familiarity of code and code conventions.
  • Understood the process of submitting a patch and review (phabricator, gerrit and git).
  • Understood how to write a PHPCS sniffer and written a few of them (see "Bugs worked on" for more details).
  • As a user, obviously, I have used Wikipedia and other wiki sites as any other student has :)

Time management

I will not be working on any other projects during the time Dec 7 to Mar 7. My winter holidays happen during the time of Outreachy, so I will not be having academics interfering with it.
I may plan a vacation for a few days (maximum 4 days) around Christmas (Dec 25), but I can make up the time in other weeks.
I plan to work around 8 hours a day (as mentioned in Typical working hours) and that gives around 40 hrs per week (not including weekends). These are of courses flexible depending on whether all my deadlines are met.

Bugs worked on
  • T92744 : Assign in if/while in CodeSniffer (patch submitted)
  • T114633 : Handle comments with multiple # (patch submitted)
  • T92751 : Test suite revamp in CodeSniffer - also a fix for T108458 (patch submitted)
  • T101311 : If else structure in CodeSniffer (done)
  • T114267 : Sniff to detect usage of dirname(__FILE__) (done)
  • T100467 : Rename "resource" module names for MobileFrontend (done)
  • T106005 : Change blue colors to standard color (done)

Also gave inputs on a host of other tasks which can be seen at my profile - http://phabricator.wikimedia.org/p/TasneemLo/

Other Information

(as mandated by Outreachy application format - https://wiki.gnome.org/Outreachy#Submit_an_Application)

Do you meet the eligibility requirements outlined? Yes

Preferred pronoun - she

Education - Student at Stella Maris in Bachelor, Visual Arts. Graduating in 2017

How did you hear about this program - A friend who participated in GSoC

Event Timeline

TasneemLo raised the priority of this task from to Lowest.
TasneemLo updated the task description. (Show Details)
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 15 2015, 12:57 PM
TasneemLo set Security to None.
TasneemLo updated the task description. (Show Details)Oct 26 2015, 8:14 AM

Hi! We noticed you're a student. How much time do you think you can commit to the project per week? And would you be taking time off for exams or other commitments? A rough estimate of hours per week you can put in would be good.

TasneemLo updated the task description. (Show Details)Oct 26 2015, 12:55 PM

@NiharikaKohli Thanks for the comment. I had mentioned the typical working hours, but had forgotten to mention that I do not have any classes during the time of Outreachy - so, academics won't clash for me.
I've updated the proposal with average time per week and described my plans for Time management in more detail.

TasneemLo updated the task description. (Show Details)Oct 27 2015, 11:24 AM

We are approaching the Outreachy'11 application deadline, and if you want to have your proposal considered to be part of this round, do sign up and add your proposal at https://outreachy.gnome.org/ before November 02 2015, 07:00 pm UTC. You can copy-paste the above proposal to the Outreachy application system, and keep on polishing it over here. Keep in mind that your mentors and the organization team will be evaluating your proposal here in Phabricator, and you are free to ask and get more reviews complying https://www.mediawiki.org/wiki/Outreach_programs/Life_of_a_successful_project#Answering_your_questions

We find that you are having university/school during the Outreachy round 11 internship period ( Dec 2015 - March 2016 ). Please answer all the questions too in your proposal description so that we stick to the Outreachy norms. Thank You!

https://wiki.gnome.org/Outreachy#Application_Form

Will you have any other time commitments, such as school work, exams, research, another job, planned vacation, etc., between December 7, 2015 and March 7, 2016? How many hours a week do these commitments take? If a student, please list the courses you will be taking between December 7, 2015 and March 7, 2016, how many credits you will be taking, and how many credits a full-time student normally takes at your school:

01tonythomas closed this task as Declined.Nov 23 2015, 8:45 AM

Thank you for your proposal. Sadly, the Outreachy administration team made it strict that candidates with any kind of academic/other commitments are not approved for this round. Please consider talking with your mentors about further steps, and we hope to see your application ( the same too, if the consensus still exist ) in the next round of GSoC/Outreachy. Closing the same as declined, and all the very best for the next round!