Page MenuHomePhabricator

GSoC/Outreachy Proposal for Improving static analysis tools for Mediawiki
Closed, DeclinedPublic

Description

Information about me

Name: Aashaka Shah
Email: aashaka96@gmail.com
IRC nick: aashaka
Github profile: https://github.com/aashaka
Location: Roorkee, Uttarakhand, India
Typical Working Hours:
Till July 15: 10 am - 1 pm, 3 pm - 6 pm, 10 pm - 12 midnight
After July 15: 6 am - 8 am, 6 pm - 12 midnight
Time Zone: IST (Indian Standard Time) (UTC +05:30)
Preferred pronoun: She
Do you meet the eligibility requirements outlined at https://wiki.gnome.org/Outreachy#Eligibility? Yes, I meet the requirements.

Synopsis

PHPCS is a code sniffer for PHP language which raises errors or warnings on encountering deviation in coding standards. It is also used by Mediawiki to sniff out coding convention malpractices and errors. The aim of the project is to make especially Mediawiki development easier and improve the quality of development. Code Sniffs more related to Mediawiki code can be added. They will give error on using deprecated code structure, and also provide a fix to change the code where coding convention was breached into convention conforming code.

Possible mentors: Ebernhardson, Legoktm

Deliverables

1) Mainly there are 3 important deliverables:

  1. Good Mediawiki-specific Sniffs.
  2. Improving test suite of Mediawiki’s phpcs Standard
  3. Conversion of selected Structure Tests into Sniffs

1.1) Good Mediawiki-specific Sniffs:

(A) Initial list of Sniffs:

  1. T127241: Give error on unclosed @codingStandardsIgnoreStart annotations
  2. Sniff to verify that comments on the same line as the code start with a space instead of a tab.
  3. Using $dbr->query() directly instead of using $dbr->select() wrapper
  4. Use of wfMessage() when $this->msg() is usable
  5. Using globals ($wgUser, $wgRequest) when their context equivalents could be used instead ($this->getUser(), $this->getRequest())
  6. Modifying certain globals ($wgUser, $wgResourceModules, etc) inside a $wgExtensionFunction where it is either too early or late to do so

(B) Assumption: From the Community suggested sniffs and the initial list of Sniffs, the Sniffs would be selected according to their importance and specificness to Mediawiki. Since the list already has good Mediawiki-specific sniffs, only 3-4 from the Community suggested sniffs will be chosen for implementation.

1.2) Improving test suite of Mediawiki’s phpcs Standard:
The problem with the current Test Suites for Mediawiki is that they don’t verify whether a_b_c_fail.php test file fails for ABCSniff. It may happen that it fails for some other Sniff and passes for ABCSniff. Yet, since it fails, a_b_c_fail.php is assumed to be correct test for ABCSniff.

This task has been dealt to a huge extent in https://gerrit.wikimedia.org/r/#/c/237899/ . My task would be to understand the code and build up from there. The basic class hierarchy is as follows:
AbstractSniffTest Class which is implemented by all ConcreteTest Classes. Each test is performed in a UnitTest way.

2) Wishlist:
(It includes tasks I would wish to do if I have more time during GSoC intern or after the GSoC period, but which don’t necessarily have to be complete for the GSoC project to be complete )

T108458: Adapt MW-CS test framework to support testing sniffs that support auto-fixing (phpcbf)
Since it is related to improving test suite of Mediawiki, it might be possible to move ahead and complete a chunk of this task during GSoC intern.

3) Features of Project:

  1. Involvement of Community in identifying Sniffs
  2. Proper Documentation
  3. Weekly Reports
  4. Thorough testing
  5. Reviewing work after each separated out blocks of time.
  6. Side-by-side implementation for phpcbf, of all Sniffs implemented. (Wherever fix is possible)

4) Timeline:

(A) Rough Timeline: ( Deliverable-wise Timeline):

WeekDurationTask
023 April - 23 MayCommunity Bonding Period and Prerequisite Work
1 - 323 May - 12 JuneCode easy sniffs
4 - 813 June - 17 JulyCode more complex sniffs
9 - 1118 July - 07 AugConvert some structure tests into sniffs
1208 Aug - 14 AugClose obsolete Phabricator tasks
1315 Aug - 23 AugPencil Down Stage.

(B) Implementation-wise timeline:

Week 0 ( 23 April - 23 May ) :

  • Prepare a list of sniffs by taking suggestions from the Wikimedia community.
  • List out sniffs which are feasible from the wish list after discussions with the mentors
  • Sort them according to the difficulty of implementation.
  • Keep understanding the Mediawiki code conventions.

Week 1 - 3 ( 23 May - 12 June ) :

  • Pick up the easy sniffs one by one.
  • Code, test, possibly document, and push changes.
  • Add ability to automatically fix each error/ warning the sniff generates.

Week 4 - 7 ( 13 June - 10 July ) :

  • Start with the more complex sniffs.
  • Code, test, document, and push changes.
  • Add ability to automatically fix each error/ warning the sniff generates.

Week 8 - 9 (11 July - 24 July ) :

  • Convert Structure Tests into Sniffs

Week 10 - 12 ( 25 July - 14 Aug ) :

  • Improve test suite for Mediawiki phpcs Standard
  • Close obsolete Phabricator tasks.

Week 13 ( 15 Aug - 23 Aug ) :

  • Pencil down stage. Finish documentation of the project.

(C) Weekly task-wise timeline:

Week 0 ( 23 April - 22 May )

  1. Community Bonding Period and Prerequisite Work

Week 1 ( 23 May - 29 May ) :

  1. Sniff to verify that comments on the same line as the code start with a space instead of a tab.
  1. T127241: Give error on unclosed @codingStandardsIgnoreStart annotations

Week 2 ( 30 May - 05 Jun ) :

  1. Using $dbr->query() directly instead of using $dbr->select() wrapper
  1. Community Sniff 1

Week 3 ( 06 Jun - 12 Jun ) :
Use of wfMessage() when $this->msg() is usable

Week 4 ( 13 Jun - 19 Jun ) :
Using globals when their context equivalents could be used instead.

Week 5 ( 20 Jun - 26 Jun ) :
Modifying certain globals ($wgUser, $wgResourceModules, etc) inside a $wgExtensionFunction where it is either too early or late to do so.

Week 6 ( 27 Jun - 03 July ) :
Community Sniff 2

Week 7 ( 04 July - 10 July ) :
Community Sniff 3

Week 8 ( 11 July - 17 July ) :
Shift Structure Tests into Sniffs

Week 9 ( 18 July - 24 July ) :
Shift Structure Tests into Sniffs

Week 10 ( 25 July - 31 July ) :
T92751: Improve test suite for Mediawiki phpcs Standard

Week 11 ( 01 Aug - 07 Aug ) :
T92751: Improve test suite for Mediawiki phpcs Standard

Week 12 ( 08 Aug - 14 Aug ) :

  1. T92751: Improve test suite for Mediawiki phpcs Standard
  1. Close obsolete Phabricator tasks.

Week 13 ( 15 Aug - 23 Aug ) :
Pencil down stage. Finish documentation of the project.

Participation
I will be in contact with my mentors daily via IRC. I will also be in touch with my mentors weekly or biweekly by mail or video call, when we can discuss work already done, and to be done that week. To keep a record, I will maintain a blog (https://arbitstrings.wordpress.com/) updated with weekly progress reports along with my experiences while working on this project. I plan to push my code for review to gerrit on a regular basis.

In case I come across a roadblock, my first step would be to Google it. In case I still remain stuck after some efforts, I will ask questions on IRC to my mentors and other community members. If that doesn't work out, I will float a mail to wikimedia-tech and my mentors.

I have found the Wikimedia Community to be a helpful group of people, willing to answer questions. I pushed my first patch on gerrit after asking a few questions on IRC. Once I submitted it for review, I could feel people on IRC who had helped me, join the celebration of me having submitted my first patch. Since then, I have tried to be online on IRC in channels MediaWiki-General and #wikimedia-dev whenever circumstances permitted.

About you

I am a programmer at Software Development Section, IIT Roorkee (SDS). If I were to describe myself in just a few sentences, I would say that I believe in giving the best to whatever I do. I don't believe in giving up or backing out of anything. I am excited by how code makes things work. I have experience in working with PHP, C++, and Java. I have worked on projects having an MVC architecture and am familiar with it.

The first Phabricator task which I resolved, T105648, involved passing an IContextSource as a parameter to a function to prevent the use of a global variable. I had thought that something which warns a developer that they are using a global variable, when something else could be used, would be really nice. T89682: Improving static analysis of Mediawiki aims to do something like that and more! A project like this will make the process of contribution and reviewing them easier for developers and reviewers, respectively. This project will also remove a chunk of old phabricator bugs. This is something I will take demonic pleasure in doing. Also, it will help new contributors get over the feeling of getting it wrong because of strict code conventions. The project will also help in following good conventions.

Education:
I am currently a Sophomore student pursuing B.Tech in Computer Science and Engineering at Indian Institute of Technology, Roorkee.

How did you hear about this program?
I heard about this program from a senior, who was previously an Outreachy intern in Mediawiki, and other seniors in SDS (Software Development Section, IIT Roorkee) who have been GSoC internees.

Will you have any other time commitments, such as school work, exams, research, another job, planned vacation, etc., between May 23 and August 23, 2016? Please provide exact dates for these commitments and the number of hours a week these commitments take.
I do not plan on having any other commitment apart from working on this project till July 15. I will be able to work more than 42 hours a week. After that, I will have academic commitments due to opening of college. I will still be able to give a lower limit of 40 hours, as the intern will only overlap with the initial one month of college, during which I would have completed a major part of the project, and the academic load would also be light. For any two days, between 15 July - 20 July, I would be traveling from home to college. Thus I might not be able to be active for these couple of days. The contact hours for college are 23 hours per week.

If a student, please list the courses you will be taking between May 23 and August 23, 2016, how many credits you will be taking, and how many credits a full-time student normally takes at your school. Please provide a link or upload your school's academic calendar.

CourseCreditNormal credits
Data Base Management Systems44
Theory of Computation44
Computer Networks44
Departmental Elective44
Computer Networks Laboratory22
Technical Communication22
Management Elective33

The next semester's Academic calendar is not out yet, but it will be almost similar to the last year's calendar:
http://www.iitr.ac.in/academics/uploads/File/2015/Academic%20Calendar%20Autumn%20Semester%202015-16%2815072015%29.pdf

We advise all candidates eligible to Google Summer of Code and Outreachy (previously known as FOSS Outreach Program for Women) to apply for both programs. Are you planning to apply to both programs and, if so, with what organization(s)?
Yes. I will be applying for both GSoC and Outreachy. I plan to focus only on this particular project (Improving static analysis of Mediawiki) of Wikimedia.

Past experience

Please describe your experience with any other FOSS projects as a user and as a contributor:
I am pretty new to the Open Source Community. Wikimedia is the first FOSS project that I have contributed to. I also participated in a Mediawiki hackathon which was organized at Indian Institute of Technology, Roorkee on March 12. Apart from this, I am a frequent user of Wikipedia. I like the idea of open source, hackable software and feel that I will continue to enjoy contributing to FOSS like I am now. I use the GNU Compiler Collection for compiling C, C++ and Java code, GNU/Linux as my primary OS (current distributon: Ubuntu with Gnome as the Desktop Environment) and Mozilla Firefox as my primary web browser.

Please describe any relevant projects that you have worked on previously and what knowledge you gained from working on them (include links):
I have worked on quite a few developmental projects:

  1. I was involved in the development of Backdoor, a website which hosts Capture the Flag style problems year-long. Its backend is written in PHP. I implemented pagination of the Backdoor leaderboard. Instead of the normal GET request to the server, I used AJAX to move to the next/previous page of the leaderboard. I also implemented a badge notification system using Symfony's event dispatcher component for the website.
  2. I was a part of a team of 4 students who made an application to categorize One Drive files into appropriate folders. We used One Drive Api to get the files and Monkeylearn API for machine learning. I was responsible for the major backend of the app. It came first in a 24-hour hackathon, Code.Fun.Do conducted by Microsoft in October 25. Link to the project: Github

What project(s) are you interested in (these can be in the same or different organizations)?
T89682: Improving static analysis tools of Mediwiki

Do you have any past experience working in open source projects (MediaWiki or otherwise)? If so, tell us about it! If you have already written a feature or bugfix in a Wikimedia technology such as MediaWiki, link to it here; we will give strong preference to candidates who have done so.
Bugfixes I have done/ am working on, related to Mediawiki-CodeSniffer:

  1. T116561: Sniff to verify the position of boolean operators inside an if condition (Patch-For-Review) ( https://gerrit.wikimedia.org/r/#/c/279615/ )
  1. T127572: "Uninitialized string offset: 72" errors from SpaceBeforeSingleLineCommentSniff.php

Some other bugs I have worked on in Mediawiki:

  1. T105648:ChangeTags::formatSummaryRow needs a context (Merged in master) ( https://gerrit.wikimedia.org/r/#/c/267456/,

https://gerrit.wikimedia.org/r/#/c/267250/ )

  1. T128718: Cite allows block content inside a span (Patch-For-Review)( https://gerrit.wikimedia.org/r/#/c/276183/ )
  2. T117743: Convert Special:ListFiles to OOUI (In-Code-Review) ( https://gerrit.wikimedia.org/r/#/c/276945/ )
  3. T51086: Title::moveTo depends on $wgUser (In-Code-Review) ( https://gerrit.wikimedia.org/r/#/c/277723/ )

I am currently working on getting my previous changes merged.

Event Timeline

@Legoktm, @EBernhardson and the rest of the community : Do have a look and suggest improvements in the proposal!

Please associate your proposal with the correct project tags. Please take a look at Life_of_a_successful_project#Submitting_your_proposal and remove the unwanted tags like Possible-Tech-Projects

IMPORTANT: The deadline for submitting your proposal for Outreachy'12 falls in less than 24 hours at Mar 22 2016, 07:00 pm UTC. . Please make sure that you have a copy of your proposal in the application system at outreachy.gnome.org beforehand, and make sure it has answers to the specific questions in https://wiki.gnome.org/Outreachy#Application_Form. You are encouraged to apply for both GSoC and Outreachy, in case you are eligible.
Aashaka raised the priority of this task from Lowest to Medium.
IMPORTANT: The deadline for submitting your proposal to Google Summer of Code 2016 application system at GSoC application system falls in roughly 24 hours at Mar 25 2016, 19:00 UTC. Please make sure that you have a pdf copy of your proposal in the application system beforehand, to avoid last minute confusions. Remember to relate your Phabricator task and associate 2 mentors in the proposal description, so that it gets easy for review. Past the deadline, you should only make changes limited to fixing typos, or incorporating feedback's. Good Luck, and check out the micro-tasks!

Since this proposal is valid for both GSoC and Outreachy, we are considering it for GSoC only, as per our rules at https://www.mediawiki.org/wiki/Google_Summer_of_Code/Admins#Proposal_submission_phase

@Legoktm , @EBernhardson , @Addshore, and others, I have changed my proposal to reflect the final draft submitted at the Summer of Code with Google site. :)

Thank you for your proposal, but sadly it didn't make it to the selects this time. You are welcome to apply for Outreachy round'13, or GSoC round 14 with the same proposal ( if it still have consensus ) or a new one if elibible. Please notify your siblings below 18 years of age about the Google Code In 2016 ( g.co/gci ) round and add yourself as a mentor for the same, if eligible. Closing the proposal as Declined, see you around in #wikimedia-dev.