Rafidaslam has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398076 )

Change subject: Enable 
MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment
......................................................................

Enable MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment

Re-enable
MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment
sniff.

Bug: T170579
Change-Id: I86214d926687676441cc11cfe9d708e905557262
---
M .phpcs.xml
M includes/MobileContext.php
M includes/MobileFrontend.body.php
M includes/MobileFrontend.hooks.php
M includes/MobileFrontend.skin.hooks.php
M includes/WMFBaseDomainExtractor.php
M includes/api/ApiMobileView.php
M includes/specials/MobileSpecialPage.php
M includes/specials/SpecialMobileDiff.php
M includes/specials/SpecialMobilePreferences.php
M includes/specials/SpecialMobileWatchlist.php
M includes/specials/SpecialNearby.php
M tests/phpunit/MobileFormatterTest.php
M tests/phpunit/api/ApiMobileViewTest.php
M tests/phpunit/diff/InlineDifferenceEngineTest.php
M tests/phpunit/specials/SpecialMobileLanguagesTest.php
16 files changed, 93 insertions(+), 43 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/76/398076/1

diff --git a/.phpcs.xml b/.phpcs.xml
index a593df0..25cb6e7 100644
--- a/.phpcs.xml
+++ b/.phpcs.xml
@@ -3,7 +3,6 @@
        <rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
                <exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" />
                <exclude name="MediaWiki.Files.OneClassPerFile.MultipleFound" />
-               <exclude 
name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment"/>
        </rule>
        <rule ref="Generic.Files.LineLength">
                <exclude-pattern>MobileFrontend\.alias\.php</exclude-pattern>
diff --git a/includes/MobileContext.php b/includes/MobileContext.php
index c5e1946..4e6f1de 100644
--- a/includes/MobileContext.php
+++ b/includes/MobileContext.php
@@ -835,7 +835,8 @@
         */
        protected function updateMobileUrlHost( &$parsedUrl ) {
                if ( IP::isIPAddress( $parsedUrl['host'] ) ) {
-                       return; // Do not update host when IP is used
+                       // Do not update host when IP is used
+                       return;
                }
                $mobileUrlHostTemplate = $this->parseMobileUrlTemplate( 'host' 
);
                if ( !strlen( $mobileUrlHostTemplate ) ) {
@@ -850,7 +851,8 @@
                        if ( strstr( $templateHostPart, '%h' ) ) {
                                $parsedHostPartKey = substr( $templateHostPart, 
2 );
                                if ( !array_key_exists( $parsedHostPartKey, 
$parsedHostParts ) ) {
-                                       return; // invalid pattern for this 
host, ignore
+                                       // invalid pattern for this host, ignore
+                                       return;
                                }
                                $targetHostParts[$key] = 
$parsedHostParts[$parsedHostPartKey];
                        } elseif ( isset( $parsedHostParts[$key] )
diff --git a/includes/MobileFrontend.body.php b/includes/MobileFrontend.body.php
index b142f42..d2b059a 100644
--- a/includes/MobileFrontend.body.php
+++ b/includes/MobileFrontend.body.php
@@ -70,7 +70,7 @@
 
                if ( $context->getContentTransformations() ) {
                        // Remove images if they're disabled from special 
pages, but don't transform otherwise
-                       $formatter->filterContent( /* remove defaults */ 
!$isSpecialPage,
+                       $formatter->filterContent( !$isSpecialPage,
                                $removeReferences, $removeImages, 
$showFirstParagraphBeforeInfobox );
                }
 
diff --git a/includes/MobileFrontend.hooks.php 
b/includes/MobileFrontend.hooks.php
index 359e956..37636b8 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -374,7 +374,8 @@
                $cookies[] = MobileContext::STOP_MOBILE_REDIRECT_COOKIE_NAME;
 
                if ( $context->shouldDisplayMobileView() || !$mobileUrlTemplate 
) {
-                       $cookies[] = MobileContext::OPTIN_COOKIE_NAME; // beta 
cookie
+                       // beta cookie
+                       $cookies[] = MobileContext::OPTIN_COOKIE_NAME;
                }
                // Redirect people who want so from HTTP to HTTPS. Ideally, 
should be
                // only for HTTP but we don't vary on protocol.
@@ -1162,13 +1163,19 @@
        public static function onLoginFormValidErrorMessages( &$messages ) {
                $messages = array_merge( $messages,
                        [
-                               'mobile-frontend-watchlist-signup-action', // 
watchstart sign up CTA
-                               'mobile-frontend-watchlist-purpose', // 
Watchlist and watchstar sign in CTA
-                               'mobile-frontend-donate-image-anon', // Uploads 
link
-                               'mobile-frontend-edit-login-action', // Edit 
button sign in CTA
-                               'mobile-frontend-edit-signup-action', // Edit 
button sign-up CTA
+                               // watchstart sign up CTA
+                               'mobile-frontend-watchlist-signup-action',
+                               // Watchlist and watchstar sign in CTA
+                               'mobile-frontend-watchlist-purpose',
+                               // Uploads link
+                               'mobile-frontend-donate-image-anon',
+                               // Edit button sign in CTA
+                               'mobile-frontend-edit-login-action',
+                               // Edit button sign-up CTA
+                               'mobile-frontend-edit-signup-action',
                                'mobile-frontend-donate-image-login-action',
-                               'mobile-frontend-generic-login-new', // default 
message
+                               // default message
+                               'mobile-frontend-generic-login-new',
                        ]
                );
        }
diff --git a/includes/MobileFrontend.skin.hooks.php 
b/includes/MobileFrontend.skin.hooks.php
index f6e8e1d..2479f71 100644
--- a/includes/MobileFrontend.skin.hooks.php
+++ b/includes/MobileFrontend.skin.hooks.php
@@ -136,7 +136,9 @@
                                'Creative Commons Attribution-Share Alike 3.0' 
=> 'CC BY-SA 3.0',
                                'Creative Commons Attribution Share Alike' => 
'CC BY-SA',
                                'Creative Commons Attribution 3.0' => 'CC BY 
3.0',
-                               'Creative Commons Attribution 2.5' => 'CC BY 
2.5', // Wikinews
+                               // Wikinews
+                               'Creative Commons Attribution 2.5' => 'CC BY 
2.5',
+
                                'Creative Commons Attribution' => 'CC BY',
                                'Creative Commons Attribution Non-Commercial 
Share Alike' => 'CC BY-NC-SA',
                                'Creative Commons Zero (Public Domain)' => 'CC0 
(Public Domain)',
diff --git a/includes/WMFBaseDomainExtractor.php 
b/includes/WMFBaseDomainExtractor.php
index 624cb06..b0fda9d 100644
--- a/includes/WMFBaseDomainExtractor.php
+++ b/includes/WMFBaseDomainExtractor.php
@@ -29,15 +29,19 @@
                'wikidata.org',
                'mediawiki.org',
                'wikimediafoundation.org',
-               'local.wmftest.net' // local vagrant instances
+               // local vagrant instances
+               'local.wmftest.net'
        ];
        /**
         * @var string[]
         */
        private $wmfMultiDomainWikiHosts = [
-               '.wikimedia.org', // commons, office, meta, outreach, 
wikimania, incubator, etc...
-               '.beta.wmflabs.org', // beta cluster
-               '.wmflabs.org' // all other labs
+               // commons, office, meta, outreach, wikimania, incubator, etc...
+               '.wikimedia.org',
+               // beta cluster
+               '.beta.wmflabs.org',
+               // all other labs
+               '.wmflabs.org'
        ];
 
        /**
diff --git a/includes/api/ApiMobileView.php b/includes/api/ApiMobileView.php
index bbb37f4..c3380c9 100644
--- a/includes/api/ApiMobileView.php
+++ b/includes/api/ApiMobileView.php
@@ -94,7 +94,8 @@
                $moduleName = $this->getModuleName();
 
                if ( $this->offset === 0 && $this->maxlen === 0 ) {
-                       $this->offset = -1; // Disable text splitting
+                       // Disable text splitting
+                       $this->offset = -1;
                } elseif ( $this->maxlen === 0 ) {
                        $this->maxlen = PHP_INT_MAX;
                }
@@ -351,9 +352,11 @@
         */
        private function stringSplitter( $text ) {
                if ( $this->offset < 0 ) {
-                       return $text; // NOOP - string splitting mode is off
+                       // NOOP - string splitting mode is off
+                       return $text;
                } elseif ( $this->maxlen < 0 ) {
-                       return ''; // Limit exceeded
+                       // Limit exceeded
+                       return '';
                }
                $textLen = mb_strlen( $text );
                $start = $this->offset;
@@ -770,7 +773,8 @@
                                        : $file->getWidth();
                        }
                        if ( !$resize ) {
-                               $resize['width'] = $resize['height'] = 50; // 
Default
+                               // Default
+                               $resize['width'] = $resize['height'] = 50;
                        }
                        $thumb = $file->transform( $resize );
                        if ( !$thumb ) {
diff --git a/includes/specials/MobileSpecialPage.php 
b/includes/specials/MobileSpecialPage.php
index 2be1028..f77ad80 100644
--- a/includes/specials/MobileSpecialPage.php
+++ b/includes/specials/MobileSpecialPage.php
@@ -92,7 +92,7 @@
                $out = $this->getOutput();
                $rl = $out->getResourceLoader();
                $title = $this->getPageTitle();
-               list( $name, /* $subpage */ ) = 
SpecialPageFactory::resolveAlias( $title->getDBkey() );
+               list( $name ) = SpecialPageFactory::resolveAlias( 
$title->getDBkey() );
                $id = strtolower( $name );
                // FIXME: These names should be more specific
                $specialStyleModuleName = 'mobile.special.' . $id . '.styles';
diff --git a/includes/specials/SpecialMobileDiff.php 
b/includes/specials/SpecialMobileDiff.php
index d10e628..fd73c13 100644
--- a/includes/specials/SpecialMobileDiff.php
+++ b/includes/specials/SpecialMobileDiff.php
@@ -380,7 +380,8 @@
                $req = MobileContext::singleton()->getRequest();
                $rev2 = $req->getText( 'diff' );
                $rev1 = $req->getText( 'oldid' );
-               if ( $rev1 == 'prev' || $rev1 == 'next' ) { // Actually, both 
do the same, WTF
+               // Actually, both do the same, WTF
+               if ( $rev1 == 'prev' || $rev1 == 'next' ) {
                        $rev1 = '';
                }
                // redirect requests to the diff page to mobile view
diff --git a/includes/specials/SpecialMobilePreferences.php 
b/includes/specials/SpecialMobilePreferences.php
index 6908a64..58ea8c0 100644
--- a/includes/specials/SpecialMobilePreferences.php
+++ b/includes/specials/SpecialMobilePreferences.php
@@ -64,7 +64,10 @@
                $this->setHeaders();
                $this->outputHeader();
                $out = $this->getOutput();
-               $out->disallowUserJs(); // Prevent hijacked user scripts from 
sniffing passwords etc.
+
+               // Prevent hijacked user scripts from sniffing passwords etc.
+               $out->disallowUserJs();
+
                $this->requireLogin( 'prefsnologintext2' );
                $this->checkReadOnly();
 
diff --git a/includes/specials/SpecialMobileWatchlist.php 
b/includes/specials/SpecialMobileWatchlist.php
index c1dd171..4c6ff54 100644
--- a/includes/specials/SpecialMobileWatchlist.php
+++ b/includes/specials/SpecialMobileWatchlist.php
@@ -9,7 +9,9 @@
  * Implements the Watchlist special page
  */
 class SpecialMobileWatchlist extends MobileSpecialPageFeed {
-       const LIMIT = 50; // Performance-safe value with PageImages
+       // Performance-safe value with PageImages
+       const LIMIT = 50;
+
        const THUMB_SIZE = MobilePage::SMALL_IMAGE_WIDTH;
        const VIEW_OPTION_NAME = 'mfWatchlistView';
        const FILTER_OPTION_NAME = 'mfWatchlistFilter';
@@ -123,7 +125,8 @@
                                break;
                        case 'articles':
                                // @fixme content namespaces
-                               $conds[] = "$column = 0"; // Has to be unquoted 
or MySQL will filesort for wl_namespace
+                               // Has to be unquoted or MySQL will filesort 
for wl_namespace
+                               $conds[] = "$column = 0";
                                break;
                        case 'talk':
                                // check project talk, user talk and talk pages
diff --git a/includes/specials/SpecialNearby.php 
b/includes/specials/SpecialNearby.php
index 229dc1c..9e662a3 100644
--- a/includes/specials/SpecialNearby.php
+++ b/includes/specials/SpecialNearby.php
@@ -47,7 +47,8 @@
                                ),
                                'noscript'
                        ) .
-                       Html::closeElement( 'div' ); // #mw-mf-nearby
+                       // #mw-mf-nearby
+                       Html::closeElement( 'div' );
 
                $output->addHTML( $html );
        }
diff --git a/tests/phpunit/MobileFormatterTest.php 
b/tests/phpunit/MobileFormatterTest.php
index b1e3b41..ea4461e 100644
--- a/tests/phpunit/MobileFormatterTest.php
+++ b/tests/phpunit/MobileFormatterTest.php
@@ -64,7 +64,10 @@
                $showFirstParagraphBeforeInfobox = false
        ) {
                $t = Title::newFromText( 'Mobile' );
-               $input = str_replace( "\r", '', $input ); // "yay" to Windows!
+
+               // "yay" to Windows!
+               $input = str_replace( "\r", '', $input );
+
                $mf = new MobileFormatter( MobileFormatter::wrapHTML( $input ), 
$t );
                if ( $callback ) {
                        $callback( $mf );
diff --git a/tests/phpunit/api/ApiMobileViewTest.php 
b/tests/phpunit/api/ApiMobileViewTest.php
index 68187d1..32dae27 100644
--- a/tests/phpunit/api/ApiMobileViewTest.php
+++ b/tests/phpunit/api/ApiMobileViewTest.php
@@ -123,7 +123,8 @@
                        [ [ 1, 2 ], [ 11 ], '1|1|2|1|11|2|1' ],
                        [ [ 1, 3, 4, 5 ], [], '1|3-5|4' ],
                        [ [ 10 ], [], '10-' ],
-                       [ [], [ '20-' ], '20-' ], # 
https://bugzilla.wikimedia.org/show_bug.cgi?id=61868
+                       # https://bugzilla.wikimedia.org/show_bug.cgi?id=61868
+                       [ [], [ '20-' ], '20-' ],
                ];
        }
 
@@ -337,13 +338,15 @@
                                        'sections' => 1,
                                        'onlyrequestedsections' => true,
 
-                                       'prop' => 'namespace', // When the 
namespace is requested...
+                                       // When the namespace is requested...
+                                       'prop' => 'namespace',
                                ] + $baseIn,
                                [
                                        'mainpage' => '',
                                        'sections' => [],
 
-                                       'ns' => 0, // ... then it is returned.
+                                       // ... then it is returned.
+                                       'ns' => 0,
                                ],
                        ]
                ];
@@ -422,7 +425,9 @@
                                        'text' => '',
                                        'prop' => 'thumb',
                                        'thumbwidth' => 200,
-                                       'type' => 'image/svg' // contrived but 
needed for testing
+
+                                       // contrived but needed for testing
+                                       'type' => 'image/svg'
                                ],
                                [
                                        'sections' => [],
@@ -439,7 +444,9 @@
                                        'text' => '',
                                        'prop' => 'thumb',
                                        'thumbheight' => 200,
-                                       'type' => 'image/svg' // contrived but 
needed for testing
+
+                                       // contrived but needed for testing
+                                       'type' => 'image/svg'
                                ],
                                [
                                        'sections' => [],
@@ -456,7 +463,9 @@
                                        'text' => '',
                                        'prop' => 'thumb',
                                        'thumbwidth' => 800,
-                                       'type' => 'image/svg' // contrived but 
needed for testing
+
+                                       // contrived but needed for testing
+                                       'type' => 'image/svg'
                                ],
                                [
                                        'sections' => [],
@@ -473,7 +482,9 @@
                                        'text' => '',
                                        'prop' => 'thumb',
                                        'thumbheight' => 800,
-                                       'type' => 'image/svg' // contrived but 
needed for testing
+
+                                       // contrived but needed for testing
+                                       'type' => 'image/svg'
                                ],
                                [
                                        'sections' => [],
@@ -562,7 +573,9 @@
                        'onlyrequestedsections' => '',
                        'sections' => 1,
                        'prop' => 'protection|pageprops',
-                       'pageprops' => 'foo', // intentionally nonexistent
+
+                       // intentionally nonexistent
+                       'pageprops' => 'foo',
                ] );
 
                $context = new RequestContext();
@@ -577,9 +590,11 @@
                $pageprops = $result['mobileview']['pageprops'];
 
                $this->assertTrue( $protection[ApiResult::META_TYPE] === 
'assoc' );
-               $this->assertTrue( count( $protection ) === 1 ); // the only 
element is the array type flag
+               // the only element is the array type flag
+               $this->assertTrue( count( $protection ) === 1 );
                $this->assertTrue( $pageprops[ApiResult::META_TYPE] === 'assoc' 
);
-               $this->assertTrue( count( $pageprops ) === 1 ); // the only 
element is the array type flag
+               // the only element is the array type flag
+               $this->assertTrue( count( $pageprops ) === 1 );
        }
 
        /**
diff --git a/tests/phpunit/diff/InlineDifferenceEngineTest.php 
b/tests/phpunit/diff/InlineDifferenceEngineTest.php
index b1b84d1..530cdae 100644
--- a/tests/phpunit/diff/InlineDifferenceEngineTest.php
+++ b/tests/phpunit/diff/InlineDifferenceEngineTest.php
@@ -36,6 +36,7 @@
        }
 
        private function strip( $text ) {
-               return str_replace( "\r", '', $text ); // Windows, $@#!%#!
+               // Windows, $@#!%#!
+               return str_replace( "\r", '', $text );
        }
 }
diff --git a/tests/phpunit/specials/SpecialMobileLanguagesTest.php 
b/tests/phpunit/specials/SpecialMobileLanguagesTest.php
index 1f8d27c..8ace11d 100644
--- a/tests/phpunit/specials/SpecialMobileLanguagesTest.php
+++ b/tests/phpunit/specials/SpecialMobileLanguagesTest.php
@@ -53,7 +53,8 @@
                }
 
                return [
-                       [ // Works with one language
+                       [
+                               // Works with one language
                                [
                                        $input['es']
                                ],
@@ -61,7 +62,8 @@
                                        $expected['es']
                                ]
                        ],
-                       [ // Sorts two languages
+                       [
+                               // Sorts two languages
                                [
                                        $input['es'],
                                        $input['bs']
@@ -71,7 +73,8 @@
                                        $expected['es']
                                ]
                        ],
-                       [ // Should still sort correctly if already in correct 
order
+                       [
+                               // Should still sort correctly if already in 
correct order
                                [
                                        $input['bs'],
                                        $input['es']
@@ -81,7 +84,8 @@
                                        $expected['es']
                                ]
                        ],
-                       [ // Sorts languages case-insensitive
+                       [
+                               // Sorts languages case-insensitive
                                [
                                        $input['simple'],
                                        $input['de'],
@@ -95,7 +99,8 @@
                                        $expected['simple']
                                ]
                        ],
-                       [ // Should still sort correctly if already in correct 
order (mixed case)
+                       [
+                               // Should still sort correctly if already in 
correct order (mixed case)
                                [
                                        $input['bs'],
                                        $input['de'],

-- 
To view, visit https://gerrit.wikimedia.org/r/398076
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I86214d926687676441cc11cfe9d708e905557262
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Rafidaslam <[email protected]>

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

Reply via email to