r70006 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70005‎ | r70006 | r70007 >
Date:12:19, 27 July 2010
Author:reedy
Status:ok
Tags:
Comment:
Stylize CodeReview

Add some missing braces
Modified paths:
  • /trunk/extensions/CodeReview/backend/CodeRepository.php (modified) (history)
  • /trunk/extensions/CodeReview/backend/CodeRevision.php (modified) (history)
  • /trunk/extensions/CodeReview/backend/DiffHighlighter.php (modified) (history)
  • /trunk/extensions/CodeReview/backend/RepoStats.php (modified) (history)
  • /trunk/extensions/CodeReview/tests/CodeReviewTest.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionAuthorLink.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionAuthorView.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionCommitter.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionListView.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionStatusView.php (modified) (history)
  • /trunk/extensions/CodeReview/ui/CodeRevisionView.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/tests/CodeReviewTest.php
@@ -15,12 +15,12 @@
1616 public function testCommentWikiFormatting() {
1717 $repo = $this->createRepo();
1818 $formatter = new CodeCommentLinkerWiki( $repo );
19 -
 19+
2020 $this->assertEquals( '[http://foo http://foo]', $formatter->link( 'http://foo' ) );
2121 $this->assertEquals( '[http://example.com/bugzilla/123 bug 123]', $formatter->link( 'bug 123' ) );
2222 $this->assertEquals( '[[Special:Code/Test/456|r456]]', $formatter->link( 'r456' ) );
2323 // fails, bug 23203 and so on
24 - //$this->assertEquals( '[http://example.org foo http://example.org foo]', $formatter->link( '[http://example.org foo http://example.org foo]' ) );
25 - //$this->assertEquals( '[http://foo.bar r123]', $formatter->link( '[http://foo.bar r123]' ) );
 24+ // $this->assertEquals( '[http://example.org foo http://example.org foo]', $formatter->link( '[http://example.org foo http://example.org foo]' ) );
 25+ // $this->assertEquals( '[http://foo.bar r123]', $formatter->link( '[http://foo.bar r123]' ) );
2626 }
2727 }
\ No newline at end of file
Index: trunk/extensions/CodeReview/backend/CodeRevision.php
@@ -31,8 +31,11 @@
3232
3333 $tmp = array();
3434 foreach ( $common as $k => $v ) {
35 - if ( $v == $compare[$k] ) $tmp[] = $v;
36 - else break;
 35+ if ( $v == $compare[$k] ) {
 36+ $tmp[] = $v;
 37+ } else {
 38+ break;
 39+ }
3740 }
3841 $common = $tmp;
3942 }
@@ -45,8 +48,8 @@
4649
4750 // Check for ignored paths
4851 global $wgCodeReviewDeferredPaths;
49 - if( isset( $wgCodeReviewDeferredPaths[ $repo->getName() ] ) ) {
50 - foreach( $wgCodeReviewDeferredPaths[ $repo->getName() ] as $defer ) {
 52+ if ( isset( $wgCodeReviewDeferredPaths[ $repo->getName() ] ) ) {
 53+ foreach ( $wgCodeReviewDeferredPaths[ $repo->getName() ] as $defer ) {
5154 if ( preg_match( $defer, $rev->mCommonPath ) ) {
5255 $rev->mStatus = 'deferred';
5356 break;
@@ -88,10 +91,10 @@
8992 }
9093
9194 /**
92 - * Like getIdString(), but if more than one repository is defined
 95+ * Like getIdString(), but if more than one repository is defined
9396 * on the wiki then it includes the repo name as a prefix to the revision ID
9497 * (separated with a period).
95 - * This ensures you get a unique reference, as the revision ID alone can be
 98+ * This ensures you get a unique reference, as the revision ID alone can be
9699 * confusing (e.g. in e-mails, page titles etc.). If only one repository is
97100 * defined then this returns the same as getIdString() as there is no ambiguity.
98101 */
@@ -179,7 +182,7 @@
180183 }
181184 return true;
182185 }
183 -
 186+
184187 /**
185188 * Quickie protection against huuuuuuuuge batch inserts
186189 */
@@ -313,7 +316,9 @@
314317 foreach ( $res as $row ) {
315318 $user = $this->mRepo->authorWikiUser( $row->cr_author );
316319 // User must exist on wiki and have a valid email addy
317 - if ( !$user || !$user->canReceiveEmail() ) continue;
 320+ if ( !$user || !$user->canReceiveEmail() ) {
 321+ continue;
 322+ }
318323 // Send message in receiver's language
319324 $lang = array( 'language' => $user->getOption( 'language' ) );
320325 $user->sendMail(
@@ -508,7 +513,7 @@
509514 }
510515 return $users;
511516 }
512 -
 517+
513518 public function getReferences() {
514519 $refs = array();
515520 $dbr = wfGetDB( DB_SLAVE );
Index: trunk/extensions/CodeReview/backend/CodeRepository.php
@@ -181,12 +181,12 @@
182182 }
183183
184184 /**
185 - * Like getRevIdString(), but if more than one repository is defined
 185+ * Like getRevIdString(), but if more than one repository is defined
186186 * on the wiki then it includes the repo name as a prefix to the revision ID
187187 * (separated with a period).
188 - * This ensures you get a unique reference, as the revision ID alone can be
 188+ * This ensures you get a unique reference, as the revision ID alone can be
189189 * confusing (e.g. in e-mails, page titles etc.). If only one repository is
190 - * defined then this returns the same as getRevIdString() as there
 190+ * defined then this returns the same as getRevIdString() as there
191191 * is no ambiguity.
192192 */
193193 public function getRevIdStringUnique( $id ) {
@@ -267,7 +267,7 @@
268268 wfProfileOut( __METHOD__ );
269269 return $data;
270270 }
271 -
 271+
272272 /**
273273 * Set diff cache (for import operations)
274274 * @param $codeRev CodeRevision
@@ -394,7 +394,7 @@
395395 $res = false;
396396 return self::$userLinks[$author] = $res;
397397 }
398 -
 398+
399399 /*
400400 * returns an author name if $name wikiuser has an author associated,
401401 * or false
@@ -402,7 +402,7 @@
403403 public function wikiUserAuthor( $name ) {
404404 if ( isset( self::$authorLinks[$name] ) )
405405 return self::$authorLinks[$name];
406 -
 406+
407407 $dbr = wfGetDB( DB_SLAVE );
408408 $res = $dbr->selectField(
409409 'code_authors',
Index: trunk/extensions/CodeReview/backend/RepoStats.php
@@ -4,7 +4,7 @@
55 private $repo;
66
77 public $time;
8 -
 8+
99 // Statistics
1010 public $revisions,
1111 $authors,
Index: trunk/extensions/CodeReview/backend/DiffHighlighter.php
@@ -37,7 +37,9 @@
3838 * @return string
3939 */
4040 function colorLine( $line ) {
41 - if ( $line == '' ) return ""; // don't create bogus spans
 41+ if ( $line == '' ) {
 42+ return ""; // don't create bogus spans
 43+ }
4244 list( $element, $attribs ) = $this->tagForLine( $line );
4345 return Xml::element( $element, $attribs, $line );
4446 }
Index: trunk/extensions/CodeReview/ui/CodeRevisionAuthorLink.php
@@ -66,7 +66,7 @@
6767 $wgOut->addWikiMsg( 'code-author-badtoken' );
6868 return;
6969 }
70 -
 70+
7171 if ( strlen( $this->mTarget ) && $wgRequest->getCheck( 'newname' ) ) {
7272 $user = User::newFromName( $this->mTarget, false );
7373 if ( !$user || !$user->getId() ) {
Index: trunk/extensions/CodeReview/ui/CodeRevisionAuthorView.php
@@ -44,7 +44,7 @@
4545
4646 parent::execute();
4747 }
48 -
 48+
4949 function getSpecializedWhereClause( $dbr ) {
5050 return array( 'cr_author' => $this->mAuthor );
5151 }
Index: trunk/extensions/CodeReview/ui/CodeRevisionCommitter.php
@@ -43,7 +43,7 @@
4444 if ( $this->validPost( 'codereview-post-comment' ) && strlen( $this->text ) ) {
4545 $parent = $wgRequest->getIntOrNull( 'wpParent' );
4646 $review = $wgRequest->getInt( 'wpReview' );
47 - //$isPreview = $wgRequest->getCheck( 'wpPreview' );
 47+ // $isPreview = $wgRequest->getCheck( 'wpPreview' );
4848 $id = $this->mRev->saveComment( $this->text, $review, $parent );
4949 // For comments, take us back to the rev page focused on the new comment
5050 if ( !$this->jumpToNext ) {
Index: trunk/extensions/CodeReview/ui/CodeRevisionListView.php
@@ -31,11 +31,11 @@
3232 }
3333
3434 $this->showForm();
35 -
 35+
3636 // Get the total count across all pages
3737 $dbr = wfGetDB( DB_SLAVE );
3838 $revCount = $this->getRevCount( $dbr );
39 -
 39+
4040 $pager = $this->getPager();
4141
4242 // Build batch change interface as needed
@@ -169,11 +169,11 @@
170170 function getPager() {
171171 return new SvnRevTablePager( $this );
172172 }
173 -
 173+
174174 /**
175175 * Get total number of revisions for this revision view
176 - *
177 - * @return int Number of revisions
 176+ *
 177+ * @return int Number of revisions
178178 */
179179 function getRevCount( $dbr ) {
180180 $tables = array( 'code_rev' );
@@ -199,7 +199,7 @@
200200 else
201201 return 0;
202202 }
203 -
 203+
204204 /**
205205 * @todo Document
206206 */
@@ -288,7 +288,7 @@
289289 }
290290 return $fields;
291291 }
292 -
 292+
293293 function formatValue( $name, $value ) { } // unused
294294
295295 function formatRevValue( $name, $value, $row ) {
Index: trunk/extensions/CodeReview/ui/CodeRevisionView.php
@@ -181,7 +181,7 @@
182182 }
183183 return false;
184184 }
185 -
 185+
186186 protected function canPostComments() {
187187 global $wgUser;
188188 return $wgUser->isAllowed( 'codereview-post-comment' ) && !$wgUser->isBlocked();
@@ -324,7 +324,7 @@
325325 return $hilite->render( $diff );
326326 }
327327 }
328 -
 328+
329329 protected function formatImgDiff() {
330330 global $wgCodeReviewImgRegex;
331331 // Get image diffs
@@ -356,7 +356,7 @@
357357 }
358358 return $html;
359359 }
360 -
 360+
361361 protected function formatImgCell( $path, $rev, $message ) {
362362 $viewvc = $this->mRepo->getViewVcBase();
363363 $safePath = wfUrlEncode( $path );
@@ -412,7 +412,7 @@
413413 }
414414 return "<ul class='mw-codereview-changes'>$changes</ul>";
415415 }
416 -
 416+
417417 protected function formatReferences() {
418418 $refs = implode( "\n",
419419 array_map( array( $this, 'formatReferenceInline' ), $this->mRev->getReferences() )
@@ -472,7 +472,7 @@
473473 $line .= "]</i>";
474474 return "<li>$line</li>";
475475 }
476 -
 476+
477477 protected function formatReferenceInline( $row ) {
478478 global $wgLang;
479479 $rev = intval( $row->cr_id );
Index: trunk/extensions/CodeReview/ui/CodeRevisionStatusView.php
@@ -10,7 +10,7 @@
1111 function getPager() {
1212 return new SvnRevStatusTablePager( $this, $this->mStatus );
1313 }
14 -
 14+
1515 function getSpecializedWhereClause( $dbr ) {
1616 return array( 'cr_status' => $this->mStatus );
1717 }

Status & tagging log