Extension:CodeReview
Parts of this page (those related to SVN software) are outdated. |
If you are looking for the contents of Wikimedia's CodeReview extension, there's a static dump at https://static-codereview.wikimedia.org/ |
This extension is currently not actively maintained! Although it may still work, any bug reports or feature requests will more than likely be ignored. If you are interested in taking on the task of developing and maintaining this extension, you can request repository ownership. As a courtesy, you may want to contact the author. You should also remove this template and list yourself as maintaining the extension in the page's {{Extension }} infobox. |
CodeReview Release status: unmaintained |
|
---|---|
Implementation | Special page , API |
Description | Code review tool with Subversion support |
Author(s) | Brion Vibber, Aaron Schulz, Alexandre Emsenhuber, Chad Horohoe, Sam Reed and Roan Kattouw |
Latest version | 1.19.2 (2017-09-16) |
Compatibility policy | Snapshots releases along with MediaWiki. Master is not backward compatible. |
MediaWiki | 1.25+ |
Tables | code_authors code_bugs code_comment code_paths code_prop_changes code_relations code_repo code_rev code_signoffs code_tags |
License | No license specified |
Download | Changelog |
Example | MediaWiki.org |
Quarterly downloads | 0 |
Translate the CodeReview extension if it is available at translatewiki.net | |
Issues | Open tasks · Report a bug |
CodeReview extension allows the review of SVN commits on a MediaWiki installation. It adds two new special pages, Special:Code and Special:RepoAdmin. Special:Code is the main CodeReview interface, whereas the RepoAdmin special page is rarely used to create new repositories.
Example
MediaWiki's code review was historically done using this extension on this wiki (MediaWiki.org), at Special:Code/MediaWiki.
MediaWiki was converted from SVN to Git, with Gerrit as the main code review tool, in March 2012. As a direct result of this, the CodeReview extension is no longer maintained by the Wikimedia Foundation[1] and was undeployed from Wikimedia servers in May 2022[2]. The extension is still functional and usable on third-party wikis.
Installation
- Download and move the extracted
CodeReview
folder to yourextensions/
directory.
Developers and code contributors should install the extension from Git instead, using:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/CodeReview - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'CodeReview' );
- Run the update script which will automatically create the necessary database tables that this extension needs.
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
To set up a repository:
- You need to be logged in as a user with the
repoadmin
right (by default this means a user who is a member of thesvnadmins
group). - Browse to Special:RepoAdmin
- Enter a repository name into the input box and press "Create" button
- Enter the three required paths; SVN, Bugzilla and ViewVC paths. These paths should be valid URLs, not local paths. For example, http://svn.wikimedia.org/svnroot/mediawiki/trunk/phase3 for SVN etc.
- The Bugzilla path should be the full URL to display a bug, with $1 representing the bug number (e.g.
http://www.example.com/path/to/bugzilla/show_bug.cgi?id=$1
). This path allows bug references in your commit messages to link to the appropriate bug URL.
- The Bugzilla path should be the full URL to display a bug, with $1 representing the bug number (e.g.
- Press OK.
- Now the repository has been created and you'll need to import SVN data to it. You can do this with the
svnImport.php
maintenance script in CodeReview'smaintenance
subdirectory. To run it, type:php svnImport.php YourRepoName
- If you're getting various host cannot be found and such errors, adjust
$wgMaxShellMemory
to work around a known problem when shelling out to the 'svn' command (bugzilla:26867) or try installing the PECL svn module - The script is dependent on English messages from the command line SVN client. If your SVN client outputs messages in a different languages, try changing your locale variables such as
LANG
,LC_ALL
orLANGUAGE
(on Unix, typelocale
to see the current values).
- If you're getting various host cannot be found and such errors, adjust
- After the import is done, you should be able to review commits through Special:Code/YourProjectName, where YourProjectName is the name of the project you gave in Special:RepoAdmin.
Automating updates
You can set up your Subversion repository to ping CodeReview through the MediaWiki API on commit, allowing it to stay continuously up to date.
In the repository on your SVN server there's a subdirectory hooks
, in which you'll find the post-commit
hook file.
Add a line something like this:
# Hit CodeReview wget -q -O /dev/null --post-data="action=codeupdate&format=xml&repo=MyRepoName&rev=$2" \ "http://wiki.example.com/api.php" &
In response to this ping, the CodeReview server will fetch all updates up to the current revision from the SVN repository.
(If wget
is not available on the server, you should be able to do the same with curl
but a slightly different command line. Note that you must POST the request to the API, and anonymous clients need to have permission to access the wiki and its API.)
Requirements
A working installation of the command-line SVN client is needed, and the svn PECL extension is recommended.
Parameters
Parameter name | Default value | Description |
---|---|---|
$wgSubversionProxy
|
false | If you can't directly access the remote SVN repo, you can set this to an offsite proxy running this fun little proxy tool: http://svn.wikimedia.org/viewvc/mediawiki/trunk/tools/codereview-proxy/ |
$wgSubversionProxyTimeout
|
30 | Timeout for the CodeReview proxy ($wgSubversionProxy ) in seconds.
|
$wgSubversionOptions
|
'--non-interactive --trust-server-cert'
|
Command-line options to pass on SVN command line if SVN PECL extension isn't available and we're not using the proxy. Defaults here should allow working with both http: and https: repos as long as authentication isn't required. |
$wgCodeReviewImportBatchSize
|
400 | What is the default SVN import chunk size? |
$wgCodeReviewShuffleTagCloud
|
false | Whether to shuffle the tag cloud (displayed at Special:Code/YourRepoName/tag). |
$wgSubversionUser
|
false | If you are running a closed SVN, fill this with username of a user allowed to access it. Otherwise, leave it false. This is only necessary if using the shell method to access Subversion. |
$wgSubversionPassword
|
false | If you are running a closed SVN, fill this with password of the account defined at $wgSubversionUser . Otherwise, leave it false. This is only necessary if using the shell method to access Subversion.
|
$wgCodeReviewENotif
|
false | Enable CodeReview e-mail notifications? Setting this to true "spams" committers when someone changes the commit's status, posts a comment on the commit or makes a follow-up revision to it.
|
$wgCodeReviewCommentWatcherEmail
|
false | Set this to an e-mail list to send all comments to |
$wgCodeReviewCommentWatcherName
|
'CodeReview comments list'
|
Name to use in the To: header of emails to the list. Ignored if $wgCodeReviewCommentWatcherEmail isn't set |
$wgCodeReviewDisableFollowUpNotification
|
false | Set this flag to true if you want to disable the automatic notifications to all watchers of a specific revision, when a follow-up to that revision is committed. Useful for small repos when everyone is reading the commit e-mails anyway, or if you have multiple repositories which refer to one another, which result in an unreasonable level of false positives. Note that the new revision will still be marked as a follow-up - this setting just stops the e-mail being sent. |
$wgCodeReviewImgRegex
|
'/\.(png|jpg|jpeg|gif)$/i'
|
Regular expression used to determine what images can be used for client-side side-by-side comparisons. |
$wgCodeReviewMaxDiffSize
|
500000 | Maximum size of diff text before it is omitted from the revision view |
$wgCodeReviewMaxDiffPaths
|
20 | The maximum number of paths that we will perform a diff on. If a revision contains more changed paths than this, we will skip getting the diff altogether. May be set to 0 to indicate no limit. |
$wgCodeReviewDeferredPaths
|
array() | Key is repository name. Value is an array of regexes. Any base paths matching regular expressions in these arrays will have their default status set to deferred instead of new. Helpful if you've got a part of the repository you don't care about.
For example: You may want to take a look at an old version of the configuration that MediaWiki.org used to use for further inspiration. |
$wgCodeReviewAutoTagPath
|
array() | Key is repository name. Value is an array of key value pairs of the path and then tags. An array (or string, for 1 tag) of tags to add to a revision upon commit.
For example: |
$wgCodeReviewFixmePerPath
|
array() | Key is repository name. Value is an array of paths to get the 'fixme' list for. This is used to display statistics (i.e. number of revisions that are in the 'fixme' state for each of the listed paths).
For example: You may want to take a look at an old version of the configuration that MediaWiki.org used to use for further inspiration. |
$wgCodeReviewNewPerPath
|
array() | Key is repository name. Value is an array of paths to get the 'new' list for. This is used to display statistics (i.e. number of revisions that are in the 'new' state for each of the listed paths).
For example: You may want to take a look at an old version of the configuration that MediaWiki.org used to use for further inspiration. |
$wgCodeReviewUDPAddress
|
false | UDP comment and status changes notification. See also the related core MediaWiki configuration variable, $wgRC2UDPAddress . |
$wgCodeReviewUDPPort
|
false | UDP comment and status changes notification. See also the related core MediaWiki configuration variable, $wgRC2UDPPort . |
$wgCodeReviewUDPPrefix
|
(empty string) | UDP comment and status changes notification. See also the related core MediaWiki configuration variable, $wgRC2UDPPrefix . |
$wgCodeReviewRepoStatsCacheTime
|
6 * 60 * 60 (=6 hours) | How long to cache repository statistics (Special:Code/MyRepoName/stats) in seconds |
$wgCodeReviewStates
|
array( 'new', 'fixme', 'reverted', 'resolved', 'ok', 'deferred', 'old' )
|
Possible states a revision can be in. A system message will still needed to be added as [[MediaWiki:Code-status-STATUSNAMEGOESHERE]]. |
$wgCodeReviewProtectedStates
|
array( 'ok', 'resolved' )
|
Revisions states that a user cannot change to on their own revision |
$wgCodeReviewFlags
|
array( 'inspected', 'tested' )
|
List of all flags a user can mark themself as having done to a revision (the signoff feature, in other words). A system message will still needed to be added as [[MediaWiki:Code-signoff-flag-FLAGNAMEGOESHERE]]. |
User rights
User right name | Group which is given this right by default | Description |
---|---|---|
codereview-use
|
* | User right required to access (view) Special:Code, and hence its subpages. Given to everyone by default. |
codereview-add-tag
|
user | User right required to add tags to commits. |
codereview-remove-tag
|
user | User right required to remove tags from commits. |
codereview-post-comment
|
user | Allows posting comments on commits. |
codereview-set-status
|
user | Allows changing the status of a commit. Statuses are defined by the configuration variable $wgCodeReviewStates .
|
codereview-signoff
|
user | Allows to use the signoff feature. Signoff is basically advertising other reviewers that you've either inspected, tested or done both to a particular commit, and the signoff feature is meant for users who are not comfortable enough to mark the commit as OK. |
codereview-associate
|
user | Allows managing revision associations, i.e. which commit is a follow-up to a previous commit, etc. |
codereview-link-user
|
user | Allows to associate SVN accounts with wiki accounts (which is needed for CodeReview's e-mail functionality, so that CR knows to which address it should send the e-mail(s)). |
codereview-review-own
|
(no group has this right by default) | User right required for users to be able to review their own commits. |
repoadmin
|
svnadmins | Required to access Special:RepoAdmin in order to add new repositories or change existing repositories' settings. To add yourself to the new svnadmins group, which is created by the CodeReview extension, visit Special:UserRights on your wiki.
|