Remove comments literally repeating the next line of code
authorThiemo Kreuz <thiemo.kreuz@wikimedia.de>
Wed, 27 Feb 2019 15:29:35 +0000 (16:29 +0100)
committerThiemo Kreuz (WMDE) <thiemo.kreuz@wikimedia.de>
Wed, 27 Feb 2019 17:28:40 +0000 (17:28 +0000)
I would argue that these comments do not add any information that
would not be there already. Having them adds mental overhead, because
one needs to read both the comment and the next line of code first to
understand they say the exact same. I don't find this helpful, but
more distracting.

Change-Id: I39c98f25225947ebffdcc2fd8f0243e7a6c070d7

18 files changed:
includes/Html.php
includes/api/ApiFeedWatchlist.php
includes/api/ApiMain.php
includes/api/ApiQuery.php
includes/changetags/ChangeTagsLogItem.php
includes/clientpool/SquidPurgeClient.php
includes/config/EtcdConfig.php
includes/media/Exif.php
includes/parser/CoreParserFunctions.php
includes/preferences/DefaultPreferencesFactory.php
includes/resourceloader/ResourceLoaderModule.php
includes/revisiondelete/RevDelLogItem.php
includes/specials/SpecialNewpages.php
includes/specials/SpecialTags.php
includes/user/BotPassword.php
maintenance/syncFileBackend.php
resources/Resources.php
tests/phpunit/includes/linker/LinkRendererTest.php

index 0aea7ea..1e597b6 100644 (file)
@@ -983,7 +983,6 @@ class Html {
                                $attribs["xmlns:$tag"] = $ns;
                        }
                } else { // HTML5
-                       // DOCTYPE
                        $ret .= "<!DOCTYPE html>\n";
                }
 
index 935bb09..11b5d91 100644 (file)
@@ -102,10 +102,8 @@ class ApiFeedWatchlist extends ApiBase {
                                $fauxReqArr['wlallrev'] = '';
                        }
 
-                       // Create the request
                        $fauxReq = new FauxRequest( $fauxReqArr );
 
-                       // Execute
                        $module = new ApiMain( $fauxReq );
                        $module->execute();
 
index 8255269..680e7dc 100644 (file)
@@ -1592,17 +1592,14 @@ class ApiMain extends ApiBase {
                        $this->setupExternalResponse( $module, $params );
                }
 
-               // Execute
                $module->execute();
                Hooks::run( 'APIAfterExecute', [ &$module ] );
 
                $this->reportUnusedParams();
 
                if ( !$this->mInternalMode ) {
-                       // append Debug information
                        MWDebug::appendDebugInfoToApiResult( $this->getContext(), $this->getResult() );
 
-                       // Print result data
                        $this->printResult();
                }
        }
index c68ec2b..ae6b1a1 100644 (file)
@@ -287,7 +287,7 @@ class ApiQuery extends ApiBase {
                        }
                } elseif ( $modCacheMode === 'public' ) {
                        // do nothing, if it's public already it will stay public
-               } else { // private
+               } else {
                        $cacheMode = 'private';
                }
 
index a248c6e..75b713e 100644 (file)
@@ -85,7 +85,7 @@ class ChangeTagsLogItem extends RevisionItemBase {
                $loglink = $this->list->msg( 'parentheses' )->rawParams( $loglink )->escaped();
                // User links and action text
                $action = $formatter->getActionText();
-               // Comment
+
                $comment = $this->list->getLanguage()->getDirMark() .
                        $formatter->getComment();
 
index 36d72c2..005b326 100644 (file)
@@ -315,7 +315,7 @@ class SquidPurgeClient {
                                }
                                if ( $this->readState == 'status' ) {
                                        $this->processStatusLine( $lines[0] );
-                               } else { // header
+                               } else {
                                        $this->processHeaderLine( $lines[0] );
                                }
                                $this->readBuffer = $lines[1];
index 7020159..09d0189 100644 (file)
@@ -326,7 +326,7 @@ class EtcdConfig implements Config, LoggerAwareInterface {
        private function unserialize( $string ) {
                if ( $this->encoding === 'YAML' ) {
                        return yaml_parse( $string );
-               } else { // JSON
+               } else {
                        return json_decode( $string, true );
                }
        }
index c32a720..0fde386 100644 (file)
@@ -455,8 +455,7 @@ class Exif {
                        $val = substr( $this->mFilteredExifData[$prop], 8 );
 
                        switch ( $charCode ) {
-                               case "\x4A\x49\x53\x00\x00\x00\x00\x00":
-                                       // JIS
+                               case "JIS\x00\x00\x00\x00\x00":
                                        $charset = "Shift-JIS";
                                        break;
                                case "UNICODE\x00":
index 8ab5c31..d1d1a9c 100644 (file)
@@ -327,7 +327,6 @@ class CoreParserFunctions {
 
                $username = trim( $username );
 
-               // default
                $gender = User::getDefaultOption( 'gender' );
 
                // allow prefix and normalize (e.g. "&#42;foo" -> "*foo" ).
index 512a6b3..032c836 100644 (file)
@@ -373,7 +373,6 @@ class DefaultPreferencesFactory implements PreferencesFactory {
                        ];
                }
 
-               // Language
                $languages = Language::fetchLanguageNames( null, 'mwfile' );
                $languageCode = $this->config->get( 'LanguageCode' );
                if ( !array_key_exists( $languageCode, $languages ) ) {
index b392625..aed036b 100644 (file)
@@ -734,7 +734,6 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
                }
                $content['scripts'] = $scripts;
 
-               // Styles
                $styles = [];
                // Don't create empty stylesheets like [ '' => '' ] for modules
                // that don't *have* any stylesheets (T40024).
index bf28f60..54a715d 100644 (file)
@@ -105,7 +105,7 @@ class RevDelLogItem extends RevDelItem {
                $loglink = $this->list->msg( 'parentheses' )->rawParams( $loglink )->escaped();
                // User links and action text
                $action = $formatter->getActionText();
-               // Comment
+
                $comment = CommentStore::getStore()->getComment( 'log_comment', $this->row )->text;
                $comment = $this->list->getLanguage()->getDirMark()
                        . Linker::commentBlock( $comment );
index 2bbc0bf..1f81cf0 100644 (file)
@@ -40,7 +40,6 @@ class SpecialNewpages extends IncludableSpecialPage {
        }
 
        protected function setup( $par ) {
-               // Options
                $opts = new FormOptions();
                $this->opts = $opts; // bind
                $opts->add( 'hideliu', false );
@@ -63,13 +62,11 @@ class SpecialNewpages extends IncludableSpecialPage {
                        $opts->add( $key, $params['default'] );
                }
 
-               // Set values
                $opts->fetchValuesFromRequest( $this->getRequest() );
                if ( $par ) {
                        $this->parseParams( $par );
                }
 
-               // Validate
                $opts->validateIntBounds( 'limit', 0, 5000 );
        }
 
index 0c74e76..110fb1f 100644 (file)
@@ -237,10 +237,8 @@ class SpecialTags extends SpecialPage {
                // add raw $hitcount for sorting, because tags-hitcount contains numbers and letters
                $newRow .= Xml::tags( 'td', [ 'data-sort-value' => $hitcount ], $hitcountLabel );
 
-               // actions
                $actionLinks = [];
 
-               // delete
                if ( $showDeleteActions && ChangeTags::canDeleteTag( $tag )->isOK() ) {
                        $actionLinks[] = $linkRenderer->makeKnownLink(
                                $this->getPageTitle( 'delete' ),
@@ -250,7 +248,6 @@ class SpecialTags extends SpecialPage {
                }
 
                if ( $showManageActions ) { // we've already checked that the user had the requisite userright
-                       // activate
                        if ( ChangeTags::canActivateTag( $tag )->isOK() ) {
                                $actionLinks[] = $linkRenderer->makeKnownLink(
                                        $this->getPageTitle( 'activate' ),
@@ -259,7 +256,6 @@ class SpecialTags extends SpecialPage {
                                        [ 'tag' => $tag ] );
                        }
 
-                       // deactivate
                        if ( ChangeTags::canDeactivateTag( $tag )->isOK() ) {
                                $actionLinks[] = $linkRenderer->makeKnownLink(
                                        $this->getPageTitle( 'deactivate' ),
index e8cd94a..6db219d 100644 (file)
@@ -473,7 +473,6 @@ class BotPassword implements IDBAccessObject {
                        return Status::newFatal( 'botpasswords-locked' );
                }
 
-               // Throttle
                $throttle = null;
                if ( !empty( $wgPasswordAttemptThrottle ) ) {
                        $throttle = new MediaWiki\Auth\Throttler( $wgPasswordAttemptThrottle, [
index 49627c3..76a5721 100644 (file)
@@ -254,7 +254,7 @@ class SyncFileBackend extends Maintenance {
                                        'src' => $fsFile->getPath(), 'dst' => $dPath, 'overwrite' => 1 ];
                        } elseif ( $sExists === false ) { // does not exist in source
                                $ops[] = [ 'op' => 'delete', 'src' => $dPath, 'ignoreMissingSource' => 1 ];
-                       } else { // error
+                       } else {
                                $this->error( "Unable to sync '$dPath': could not stat file." );
                                $status->fatal( 'backend-fail-internal', $src->getName() );
 
index 1edfdd3..dfabf4b 100644 (file)
@@ -643,7 +643,7 @@ return [
                'group' => 'jquery.ui',
                'targets' => [ 'desktop', 'mobile' ],
        ],
-       // Effects
+
        'jquery.effects.core' => [
                'deprecated' => true,
                'scripts' => 'resources/lib/jquery.ui/jquery.ui.effect.js',
index d550dcb..9b1a3dd 100644 (file)
@@ -55,7 +55,6 @@ class LinkRendererTest extends MediaWikiLangTestCase {
                        $linkRenderer->makeKnownLink( $target, null, [], [ 'foo' => 'bar' ] )
                );
 
-               // forcearticlepath
                $linkRenderer->setForceArticlePath( true );
                $this->assertEquals(
                        '<a href="/wiki/Foobar?foo=bar" title="Foobar">Foobar</a>',