Page MenuHomePhabricator

Improving static analysis tools for MediaWiki
Closed, ResolvedPublic

Description

Information about you

Name: Lethexie(Xie Tao)
Email: xietaoecho@gmail.com
IRC: FreeNode/#wikimedia-dev/Lethexie
Location: Guangzhou, Guangdong, China (UTC+8:00)
Typical working hours: 16:00 - 22:00 (UTC+8:00)( 6 hours a day)

Synopsis

MediaWiki-CodeSniffer is a linting tool based on PHP_CodeSniffer. It helps MediaWiki to improve its code quality. This proposal aims to fix existing issues in the project, complete linting rules, add supports for checking functions usages and standardize sniffs.
Possible mentors: @Addshore, @EBernhardson, @Legoktm
Pros: It helps us to improve our code quality, make the source code of MediaWiki project more reliable.

Deliverables

Project details
Now MediaWiki-CodeSniffer has already implemented some helpful linting rules and coding convention rules. But there are some places we can improve:
For code sniffing:

  1. Some of our sniffs are imperfect:
    • Cannot recognize illegal format in comment like /*** fail ***/
    • Doesn’t give warnings to function or variable namings using  lower camel case
    • Unexpected empty line shows up after fixing the open brace of a function
    • Fail to check if the code use PHP superglobals (like $_GET, $_POST, etc)
    • A newline expected before a single line comment
    • Brace should be placed on the same line as the start of class
  1. We can add some rules for linting the usage of functions and variables like:
    • Usage of $dbr->query() directly instead of the $dbr->select() wrapper
    • Using wfMessage() when $this->msg() is usable
    • Using globals ($wgUser, $wgRequest) when their context equivalents could be used instead ($this->getUser(), $this->getRequest())
    • Modifying certain globals ($wgUser, $wgResourceModules, etc) inside a $wgExtensionFunction where it is either too early or late to do so
    • Avoid to use deprecated classes,functions,variables

For the source code of sniffs:

  1. Unify naming rules for sniffs
  2. Improve comment in sniffs

Project Time Line

23 May - 30 May

  • Clean up the current code
  • Recheck all of sniffer

31 May - 7 June

  • illegal format in comment like /*** fail ***/

8 June - 15 June

  • Unexpected empty line shows up after fixing the open brace of a function
  • give warnings to function or variable namings using lower camel case

16 June - 23 June

  • check if the code use PHP superglobals (like $_GET, $_POST, etc)
  • A newline expected before a single line comment

24 June - 1 July

  • Brace should be placed on the same line as the start of class
  • Contruct array of configures

2 July - 9 July

  • Classify the type of functions and class
  • Using globals ($wgUser, $wgRequest) when their context equivalents could be used instead ($this->getUser(), $this->getRequest())

10 July - 17 July

  • Using wfMessage() when $this->msg() is usable
  • List the important deprecated classes,functions,variables

18 July - 25 July

  • Modifying certain globals ($wgUser, $wgResourceModules, etc) inside a $wgExtensionFunction where it is either too early or late to do so

25 July - 1 Aug

  • Avoid to use deprecated classes,functions,variables

2 Aug - 9 Aug

  • Unify naming rules for sniffs
  • Improve comment in sniffs

10 Aug - 17 Aug

  • Recheck all the new features
  • Necessary documents

Participation

how you plan to communicate progress?
Email and IRC.
where you plan to publish your source code while you're working?
Gerrit.
how and where you plan to ask for help?
Google, IRC, Email, Phabricator.

About you

Education:
Undergraduate student in South China University of Technology 2012 - 2016
How did you hear about this program?
I heard about it from my friends.
Will you have any other time commitments, such as school work, another job, planned vacation, etc., during the duration of the program?
I need to spend some times (about 2 week) on my graduation courseworks in the first 2 weeks, this is the reason I do some easy work in the above time line.
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)?
I apply for the GSoC 2016.
We don't just care about your project -- you are a person, and that matters to us! What drives you? What makes you want to make this the most awesomest wiki enhancement ever?
I’d like to spend some times on FOSS, and I think the MediaWiki is a great choice.
You don't need to write out your life story (we can read your blog if we want that), but we want to know a little about what makes you tick. Are you a Wikipedia addict wanting to make your own experience better? Did a wiki with usability problems run over your dog, and you're seeking revenge? :-) What does making this project happen mean to you?
Wikipedia has already helped me saved a lot of time from reading dull and scattered documents. It usually offer great value to solve my problems. Also, the MediaWiki project created a great Wiki system (MediaWiki), and I am willing to make it better and easier for hacking it. BTW, It’s cool to be a developer of MediaWiki ;-)

Past experience

Please describe your experience with any other FOSS projects as a user and as a contributor:
None.
Please describe any relevant projects that you have worked on previously and what knowledge you gained from working on them (include links):

  1. Personal Management System for a student organization with hundreds of students (using CakePHP framework).
  2. Organization account based on WeChat Public Platform with thousands of users (PHP, with a hand-crafted framework).
  3. Inner System for a custom clearance company (PHP).

By working on projects above, I have improved my ability of analyzing requirements as well as developing and enhancing a PHP project.
What project(s) are you interested in (these can be in the same or different organizations)?
Improving static analysis tools for MediaWiki in MediaWiki-CodeSniffer , see https://phabricator.wikimedia.org/T89682
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.
I have read the project source code from the Git, and I written some changes as following:
https://phabricator.wikimedia.org/T129231 (patch for review)
https://phabricator.wikimedia.org/T129840 (patch for review)
https://phabricator.wikimedia.org/T130004 (patch for review)
https://phabricator.wikimedia.org/T129313 (patch for review)
Gerrit:
https://gerrit.wikimedia.org/r/#/c/275747/
https://gerrit.wikimedia.org/r/#/c/275796/
https://gerrit.wikimedia.org/r/#/c/276110/
https://gerrit.wikimedia.org/r/#/c/277227/

Event Timeline

Lethexie created this task.Mar 22 2016, 5:49 AM
Lethexie added a comment.EditedMar 22 2016, 5:57 AM

@Addshore , @EBernhardson , @Legoktm Could you give me some feedback?

Lethexie updated the task description. (Show Details)Mar 22 2016, 6:07 AM
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!

Hi @Lethexie, please elaborate on your timeline a lot more. Very detailed point on what you plan to achieve every week or fortnight. I'd also like to see a more detailed implementation plan. Also add a link to your gerrit contributions.

Thanks and good luck!

Lethexie updated the task description. (Show Details)Mar 24 2016, 2:32 PM
Lethexie claimed this task.Mar 24 2016, 2:57 PM
Sumit added a comment.Apr 22 2016, 7:53 PM

Congratulations @Lethexie for getting selected for this project in GSoC 2016! Wish you a good luck with it. You can start discussing ideas and get to speed with the project as the Community Bonding period has started.

@Sumit Thanks, excited to have this chance :)

Welcome to Google-Summer-of-Code (2016) and to the Community Bonding period! Happy to have you here, and this should be crucial time to create important decisions regarding how your project should take shape during this two month internship period. You can find information about Community bonding period, from our Life of successful doc here. To make sure everything go as per planned, please follow the instructions in T133647 and create the 'Community Bonding Evaluation for $project' task as a subtask of your proposal task. Please note that all further tasks you create for evaluation and GSoC organization purpose should be subtasks of your proposal, and not the parent task - lets reduce the notification count. In case you are stuck, feel free to comment below T133647 or open up a conpherence task with the mentors and org admins. You can find example tasks in the task description of T133647

Niharika removed a subscriber: Niharika.Apr 27 2016, 2:06 PM

@Legoktm @Addshore @EBernhardson Hi, could you give me your opinions about the detailed plan of GSoC. Also, please tell me how to contact with you during the next 3 months :D

In terms of contact, IRC (freenode) is typically the most direct method. Phabricator also works plenty well for more async communication. I'm generally available on IRC from 8/9am - 5pm PDT.

@EBernhardson About the detailed plan mentioned in T133647 ,I want to ask you for feedback on the plan mentioned in my proposal. Is it a viable scheme or anything need to improve?

@AbdealiJK Thank you , And how about the second Phabricator project created? Should I create new task in Phabricator for the GSoC project?

We recommend projects go into separate phab projects, but this one is a special case :D (kinda fitting in the parent task) . Please start a Conpherence with your mentors asking whether your task can be merged with MediaWiki-Codesniffer , or should go as a separate one. You can ask that in a phabricator task too, adding your mentors as subscribers.

@Addshore @EBernhardson @Legoktm Hi, Could you please give me some suggestions about it? In terms of contact, I hope we can talk more details in IRC freenode channel #codesniffer, I am Looking forward to getting your feedback :D

The plan generally looks good to me, no particular suggestions.

Danny_B renamed this task from [GSoC 2016 Proposal] Improving static analysis tools for MediaWiki to Improving static analysis tools for MediaWiki.Jul 7 2016, 8:11 PM
01tonythomas closed this task as Resolved.Sep 14 2016, 6:43 AM

End of project timeline. Closing it down. Thank you for all the efforts, see you as a mentor for Google Code in 2016 at g.co/gci.

Outcome of this 2016 round projects at https://www.mediawiki.org/wiki/Google_Summer_of_Code_past_projects#2016