http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70006

Revision: 70006
Author:   reedy
Date:     2010-07-27 12:19:06 +0000 (Tue, 27 Jul 2010)

Log Message:
-----------
Stylize CodeReview

Add some missing braces

Modified Paths:
--------------
    trunk/extensions/CodeReview/backend/CodeRepository.php
    trunk/extensions/CodeReview/backend/CodeRevision.php
    trunk/extensions/CodeReview/backend/DiffHighlighter.php
    trunk/extensions/CodeReview/backend/RepoStats.php
    trunk/extensions/CodeReview/tests/CodeReviewTest.php
    trunk/extensions/CodeReview/ui/CodeRevisionAuthorLink.php
    trunk/extensions/CodeReview/ui/CodeRevisionAuthorView.php
    trunk/extensions/CodeReview/ui/CodeRevisionCommitter.php
    trunk/extensions/CodeReview/ui/CodeRevisionListView.php
    trunk/extensions/CodeReview/ui/CodeRevisionStatusView.php
    trunk/extensions/CodeReview/ui/CodeRevisionView.php

Modified: trunk/extensions/CodeReview/backend/CodeRepository.php
===================================================================
--- trunk/extensions/CodeReview/backend/CodeRepository.php      2010-07-27 
12:00:30 UTC (rev 70005)
+++ trunk/extensions/CodeReview/backend/CodeRepository.php      2010-07-27 
12:19:06 UTC (rev 70006)
@@ -181,12 +181,12 @@
        }
 
        /**
-        * Like getRevIdString(), but if more than one repository is defined 
+        * Like getRevIdString(), but if more than one repository is defined
         * on the wiki then it includes the repo name as a prefix to the 
revision ID
         * (separated with a period).
-        * This ensures you get a unique reference, as the revision ID alone 
can be 
+        * This ensures you get a unique reference, as the revision ID alone 
can be
         * confusing (e.g. in e-mails, page titles etc.).  If only one 
repository is
-        * defined then this returns the same as getRevIdString() as there 
+        * defined then this returns the same as getRevIdString() as there
         * is no ambiguity.
         */
        public function getRevIdStringUnique( $id ) {
@@ -267,7 +267,7 @@
                wfProfileOut( __METHOD__ );
                return $data;
        }
-       
+
        /**
         * Set diff cache (for import operations)
         * @param $codeRev CodeRevision
@@ -394,7 +394,7 @@
                        $res = false;
                return self::$userLinks[$author] = $res;
        }
-       
+
        /*
         * returns an author name if $name wikiuser has an author associated,
         * or false
@@ -402,7 +402,7 @@
        public function wikiUserAuthor( $name ) {
                if ( isset( self::$authorLinks[$name] ) )
                        return self::$authorLinks[$name];
-       
+
                $dbr = wfGetDB( DB_SLAVE );
                $res = $dbr->selectField(
                        'code_authors',

Modified: trunk/extensions/CodeReview/backend/CodeRevision.php
===================================================================
--- trunk/extensions/CodeReview/backend/CodeRevision.php        2010-07-27 
12:00:30 UTC (rev 70005)
+++ trunk/extensions/CodeReview/backend/CodeRevision.php        2010-07-27 
12:19:06 UTC (rev 70006)
@@ -31,8 +31,11 @@
 
                                        $tmp = array();
                                        foreach ( $common as $k => $v ) {
-                                               if ( $v == $compare[$k] ) 
$tmp[] = $v;
-                                               else break;
+                                               if ( $v == $compare[$k] ) {
+                                                       $tmp[] = $v;
+                                               } else {
+                                                       break;
+                                               }
                                        }
                                        $common = $tmp;
                                }
@@ -45,8 +48,8 @@
 
                // Check for ignored paths
                global $wgCodeReviewDeferredPaths;
-               if( isset( $wgCodeReviewDeferredPaths[ $repo->getName() ] ) ) {
-                       foreach( $wgCodeReviewDeferredPaths[ $repo->getName() ] 
as $defer ) {
+               if ( isset( $wgCodeReviewDeferredPaths[ $repo->getName() ] ) ) {
+                       foreach ( $wgCodeReviewDeferredPaths[ $repo->getName() 
] as $defer ) {
                                if ( preg_match( $defer, $rev->mCommonPath ) ) {
                                        $rev->mStatus = 'deferred';
                                        break;
@@ -88,10 +91,10 @@
        }
 
        /**
-        * Like getIdString(), but if more than one repository is defined 
+        * Like getIdString(), but if more than one repository is defined
         * on the wiki then it includes the repo name as a prefix to the 
revision ID
         * (separated with a period).
-        * This ensures you get a unique reference, as the revision ID alone 
can be 
+        * This ensures you get a unique reference, as the revision ID alone 
can be
         * confusing (e.g. in e-mails, page titles etc.).  If only one 
repository is
         * defined then this returns the same as getIdString() as there is no 
ambiguity.
         */
@@ -179,7 +182,7 @@
                }
                return true;
        }
-       
+
        /**
         * Quickie protection against huuuuuuuuge batch inserts
         */
@@ -313,7 +316,9 @@
                        foreach ( $res as $row ) {
                                $user = $this->mRepo->authorWikiUser( 
$row->cr_author );
                                // User must exist on wiki and have a valid 
email addy
-                               if ( !$user || !$user->canReceiveEmail() ) 
continue;
+                               if ( !$user || !$user->canReceiveEmail() ) {
+                                       continue;
+                               }
                                // Send message in receiver's language
                                $lang = array( 'language' => $user->getOption( 
'language' ) );
                                $user->sendMail(
@@ -508,7 +513,7 @@
                }
                return $users;
        }
-       
+
        public function getReferences() {
                $refs = array();
                $dbr = wfGetDB( DB_SLAVE );

Modified: trunk/extensions/CodeReview/backend/DiffHighlighter.php
===================================================================
--- trunk/extensions/CodeReview/backend/DiffHighlighter.php     2010-07-27 
12:00:30 UTC (rev 70005)
+++ trunk/extensions/CodeReview/backend/DiffHighlighter.php     2010-07-27 
12:19:06 UTC (rev 70006)
@@ -37,7 +37,9 @@
         * @return string
         */
        function colorLine( $line ) {
-               if ( $line == '' ) return ""; // don't create bogus spans
+               if ( $line == '' ) {
+                       return ""; // don't create bogus spans
+               }
                list( $element, $attribs ) = $this->tagForLine( $line );
                return Xml::element( $element, $attribs, $line );
        }

Modified: trunk/extensions/CodeReview/backend/RepoStats.php
===================================================================
--- trunk/extensions/CodeReview/backend/RepoStats.php   2010-07-27 12:00:30 UTC 
(rev 70005)
+++ trunk/extensions/CodeReview/backend/RepoStats.php   2010-07-27 12:19:06 UTC 
(rev 70006)
@@ -4,7 +4,7 @@
        private $repo;
 
        public $time;
-       
+
        // Statistics
        public $revisions,
                $authors,

Modified: trunk/extensions/CodeReview/tests/CodeReviewTest.php
===================================================================
--- trunk/extensions/CodeReview/tests/CodeReviewTest.php        2010-07-27 
12:00:30 UTC (rev 70005)
+++ trunk/extensions/CodeReview/tests/CodeReviewTest.php        2010-07-27 
12:19:06 UTC (rev 70006)
@@ -15,12 +15,12 @@
        public function testCommentWikiFormatting() {
                $repo = $this->createRepo();
                $formatter = new CodeCommentLinkerWiki( $repo );
-               
+
                $this->assertEquals( '[http://foo http://foo]', 
$formatter->link( 'http://foo' ) );
                $this->assertEquals( '[http://example.com/bugzilla/123 bug 
123]', $formatter->link( 'bug 123' ) );
                $this->assertEquals( '[[Special:Code/Test/456|r456]]', 
$formatter->link( 'r456' ) );
                // fails, bug 23203 and so on
-               //$this->assertEquals( '[http://example.org foo 
http://example.org foo]', $formatter->link( '[http://example.org foo 
http://example.org foo]' ) );
-               //$this->assertEquals( '[http://foo.bar r123]', 
$formatter->link( '[http://foo.bar r123]' ) );
+               // $this->assertEquals( '[http://example.org foo 
http://example.org foo]', $formatter->link( '[http://example.org foo 
http://example.org foo]' ) );
+               // $this->assertEquals( '[http://foo.bar r123]', 
$formatter->link( '[http://foo.bar r123]' ) );
        }
 }
\ No newline at end of file

Modified: trunk/extensions/CodeReview/ui/CodeRevisionAuthorLink.php
===================================================================
--- trunk/extensions/CodeReview/ui/CodeRevisionAuthorLink.php   2010-07-27 
12:00:30 UTC (rev 70005)
+++ trunk/extensions/CodeReview/ui/CodeRevisionAuthorLink.php   2010-07-27 
12:19:06 UTC (rev 70006)
@@ -66,7 +66,7 @@
                        $wgOut->addWikiMsg( 'code-author-badtoken' );
                        return;
                }
-               
+
                if ( strlen( $this->mTarget ) && $wgRequest->getCheck( 
'newname' ) ) {
                        $user = User::newFromName( $this->mTarget, false );
                        if ( !$user || !$user->getId() ) {

Modified: trunk/extensions/CodeReview/ui/CodeRevisionAuthorView.php
===================================================================
--- trunk/extensions/CodeReview/ui/CodeRevisionAuthorView.php   2010-07-27 
12:00:30 UTC (rev 70005)
+++ trunk/extensions/CodeReview/ui/CodeRevisionAuthorView.php   2010-07-27 
12:19:06 UTC (rev 70006)
@@ -44,7 +44,7 @@
 
                parent::execute();
        }
-       
+
        function getSpecializedWhereClause( $dbr ) {
                return array( 'cr_author' => $this->mAuthor );
        }

Modified: trunk/extensions/CodeReview/ui/CodeRevisionCommitter.php
===================================================================
--- trunk/extensions/CodeReview/ui/CodeRevisionCommitter.php    2010-07-27 
12:00:30 UTC (rev 70005)
+++ trunk/extensions/CodeReview/ui/CodeRevisionCommitter.php    2010-07-27 
12:19:06 UTC (rev 70006)
@@ -43,7 +43,7 @@
                if ( $this->validPost( 'codereview-post-comment' ) && strlen( 
$this->text ) ) {
                        $parent = $wgRequest->getIntOrNull( 'wpParent' );
                        $review = $wgRequest->getInt( 'wpReview' );
-                       //$isPreview = $wgRequest->getCheck( 'wpPreview' );
+                       // $isPreview = $wgRequest->getCheck( 'wpPreview' );
                        $id = $this->mRev->saveComment( $this->text, $review, 
$parent );
                        // For comments, take us back to the rev page focused 
on the new comment
                        if ( !$this->jumpToNext ) {

Modified: trunk/extensions/CodeReview/ui/CodeRevisionListView.php
===================================================================
--- trunk/extensions/CodeReview/ui/CodeRevisionListView.php     2010-07-27 
12:00:30 UTC (rev 70005)
+++ trunk/extensions/CodeReview/ui/CodeRevisionListView.php     2010-07-27 
12:19:06 UTC (rev 70006)
@@ -31,11 +31,11 @@
                }
 
                $this->showForm();
-               
+
                // Get the total count across all pages
                $dbr = wfGetDB( DB_SLAVE );
                $revCount = $this->getRevCount( $dbr );
-               
+
                $pager = $this->getPager();
 
                // Build batch change interface as needed
@@ -169,11 +169,11 @@
        function getPager() {
                return new SvnRevTablePager( $this );
        }
-       
+
        /**
         * Get total number of revisions for this revision view
-        * 
-        * @return int Number of revisions 
+        *
+        * @return int Number of revisions
         */
        function getRevCount( $dbr ) {
                $tables = array( 'code_rev' );
@@ -199,7 +199,7 @@
                else
                        return 0;
        }
-       
+
        /**
         * @todo Document
         */
@@ -288,7 +288,7 @@
                }
                return $fields;
        }
-       
+
        function formatValue( $name, $value ) { } // unused
 
        function formatRevValue( $name, $value, $row ) {

Modified: trunk/extensions/CodeReview/ui/CodeRevisionStatusView.php
===================================================================
--- trunk/extensions/CodeReview/ui/CodeRevisionStatusView.php   2010-07-27 
12:00:30 UTC (rev 70005)
+++ trunk/extensions/CodeReview/ui/CodeRevisionStatusView.php   2010-07-27 
12:19:06 UTC (rev 70006)
@@ -10,7 +10,7 @@
        function getPager() {
                return new SvnRevStatusTablePager( $this, $this->mStatus );
        }
-       
+
        function getSpecializedWhereClause( $dbr ) {
                return array( 'cr_status' => $this->mStatus );
        }

Modified: trunk/extensions/CodeReview/ui/CodeRevisionView.php
===================================================================
--- trunk/extensions/CodeReview/ui/CodeRevisionView.php 2010-07-27 12:00:30 UTC 
(rev 70005)
+++ trunk/extensions/CodeReview/ui/CodeRevisionView.php 2010-07-27 12:19:06 UTC 
(rev 70006)
@@ -181,7 +181,7 @@
                }
                return false;
        }
-       
+
        protected function canPostComments() {
                global $wgUser;
                return $wgUser->isAllowed( 'codereview-post-comment' ) && 
!$wgUser->isBlocked();
@@ -324,7 +324,7 @@
                        return $hilite->render( $diff );
                }
        }
-       
+
        protected function formatImgDiff() {
                global $wgCodeReviewImgRegex;
                // Get image diffs
@@ -356,7 +356,7 @@
                }
                return $html;
        }
-       
+
        protected function formatImgCell( $path, $rev, $message ) {
                $viewvc = $this->mRepo->getViewVcBase();
                $safePath = wfUrlEncode( $path );
@@ -412,7 +412,7 @@
                }
                return "<ul class='mw-codereview-changes'>$changes</ul>";
        }
-       
+
        protected function formatReferences() {
                $refs = implode( "\n",
                        array_map( array( $this, 'formatReferenceInline' ), 
$this->mRev->getReferences() )
@@ -472,7 +472,7 @@
                $line .= "]</i>";
                return "<li>$line</li>";
        }
-       
+
        protected function formatReferenceInline( $row ) {
                global $wgLang;
                $rev = intval( $row->cr_id );



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to