= Twisted Code Review Process = All commits to Twisted's trunk must follow this review process. The only exception is for the [source:trunk/doc/fun/Twisted.Quotes Twisted Quotes] file. There are no other exceptions! Both authors and reviewers should be intimately familiar with all requirements on this page. == Authors: Before you get started == For the most part, we'd love for you to jump right in and start writing code! The code review process should catch any serious problems with your contribution, and the continuous integration system should catch most tricky cross-platform issues. It's easy to get too caught up in trying to do everything perfectly the first time and never get any code written, so you should usually err on the side of just trying something out rather than waiting for someone to tell you if it's OK. That being said, there are a few things that you should really be aware of before you write your first line of code: * Make sure you have a ''clear idea of what work needs doing''. Write down your idea first; [https://twistedmatrix.com/trac/newticket file a ticket] before you write a patch. A really good ticket will give a precise description of what needs to change and why it needs changing; it avoids giving precise details of exactly ''how'' the code needs to change, because the patch should supply those details. A really ''bad'' ticket will say "here is a patch I wrote, apply it". If you're just getting started with contributing to Twisted, it would be good to find an existing ticket rather than come up with something yourself, so you have an idea how to go through the process before you start making difficult changes. You'll need to have a good description of your work for other parts of the process as well (the NEWS file, the commit message) which is another reason thinking about what you're trying to do helps. * Try '''not''' to ''write too much code at once''. A good change really needs to be be under 1000 lines of diff for a reviewer to be able to deal with it before getting fatigued and missing things. Really, you should be aiming for things in the neighborhood of 200 lines. This is for your benefit as well as the reviewer's; we don't want you to spend weeks on a 10,000-line monster of a feature, only to have it rejected because we're not interested in having such a feature at all. == Authors: Things your branch or patch must contain == * Code which follows the [http://twistedmatrix.com/documents/current/core/development/policy/coding-standard.html coding standard]. * 100% unit test coverage for all modified and new code (even if it didn't have tests before) * 100% API docstring coverage for all modified and new code (even if it didn't have docs before) * No [CompatibilityPolicy backwards-incompatible] changes. Please also be sparing when adding 'public' names to the API, as they must be supported in the future. If it can start with an underscore and not be exposed publicly, it probably should. * Appropriate new or modified "End User" guide documentation (in the form of rst files in the [source:trunk/docs docs/] directory) * A file in all relevant "topfiles" directories describing changes which affect users (See [#Newsfiles below]) == Authors: How to get your change reviewed == * There must be a bug in the Twisted bug tracker describing the desired outcome (See [#Filingbugsandwritingreviewrequests below]). * '''Note''': For security issues, see [wiki:Security Security]. * Add the "review" keyword to the ticket. * Remove the owner field by selecting the blank option next to "Assign to". * Alternatively, assign it to someone who has already agreed to review it. * Write a comment with any relevant information for the reviewer. * If you are a Twisted committer: * Make sure your code is in a branch. * Make sure the 'branch' field on the ticket corresponds to the branch where the code is checked in. * Force a build of your branch. Do this by following these steps: * Go to the [http://buildbot.twistedmatrix.com/boxes-supported?branch=trunk&num_builds=10 Latest Builds] page linked from [http://buildbot.twistedmatrix.com/] * (If you know where the `force-builds.py` script is, you can run it instead, but if you know that, chances are you don't need to read this.) * The username is "twisted" and the password is "matrix"; fill out the form in the upper-left-hand of the page, and log in. (The only "security" here is to stop spammers from overloading the buildbots by submitting every form; the real security of the buildbot is in the fact that only committers can upload code it will run, so don't worry.) * Look in the upper-right-hand corner of the page; you should see a text area that says "branch". Type the absolute path of your branch, (such as: `/branches/my-feature-7654`) into that field, and click "force". * Copy the URL of the page you are sent to, and paste it into a comment on your ticket linking the text "build results", like this: `[http://buildbot.twistedmatrix.com/boxes-supported?branch=%2Fbranches%2Fmy-feature-4321 Build Results]` * Make sure that it's green! == Reviewers: How to review a change == * Be familiar with the Twisted codebase, coding standard, and these review requirements. * Don't be the author of the change (See [#Whocanreview below]). * Assign the ticket to yourself. * Review the change, and write a detailed comment about all potential improvements to the branch (See [#Howtobeagoodreviewer below]). * Remove the "review" keyword from the ticket. * Assign the ticket back to the author. * If the change is ready for trunk, indicate so by writing "please merge" or "+1". * Alternatively, if the author does not have commit access to trunk, merge the change for them. == Authors: How to merge the change to trunk == * Merge the change into a checkout of Twisted trunk and commit it. The message must follow this format (See [#Thecommitmessage below]). {{{ #!html
Merge <branch name>: Brief description Author: <names> Reviewer: <names> Fixes: #<ticket number> Long description (as long as you wish)}}} * After the change is merged wait for the buildbots to finish running, if there is a regression on a supported builder you should [#Revertingachange revert your merge]. == Details == === News files === It is now up to the authors of individual changes to write high-level descriptions for their changes. These descriptions will be aggregated into the release notes distributed with Twisted releases. If we just let each author add to the [source:trunk/twisted/topfiles/NEWS NEWS] files on every commit, though, we would run into lots of spurious conflicts. To avoid this, we have come up with a scheme involving separate files for each change. Changes must be accompanied by an entry in at least one `topfiles` directory. There are `topfiles` directories for each subproject (eg. [[source:trunk/twisted/names/topfiles]], [[source:trunk/twisted/words/topfiles]]), and one root directory ([[source:trunk/twisted/topfiles]]) for core Twisted changes. If a change affects multiple areas of Twisted, then each affected area can have a topfiles entry to detail the relevant changes. An entry must be a file named `
Revert r<revision number>: Brief description A description of the problem, or a traceback if pertinent Reopens: #<ticket number>}}} Reverted branches are to be reviewed again before being merged.