wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

File LocalFileDeleteBatch.php has 289 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
Severity: Minor
Found in includes/filerepo/file/LocalFileDeleteBatch.php - About 2 hrs to fix

    File MessagesHi.php has 289 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /** Hindi (हिन्दी)
     *
     * @file
     * @ingroup Languages
    Severity: Minor
    Found in languages/messages/MessagesHi.php - About 2 hrs to fix

      Function showDialog has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          showDialog( config ) {
              const { initOpenWindow, openWindow, data } = config;
      
              // Display a message in the current browser window, so that if the popup window doesn't open,
              // or if the user loses it on their desktop somehow, they can still see what was supposed to happen,
      Severity: Major
      Found in resources/src/mediawiki.authenticationPopup/AuthPopup.js - About 2 hrs to fix

        Function translate has 73 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function translate(number, withoutSuffix, key, isFuture) {
                var result = number + ' ';
                switch (key) {
                    case 's':
                        return withoutSuffix || isFuture
        Severity: Major
        Found in resources/lib/moment/locale/is.js - About 2 hrs to fix

          Function CHILD has 73 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  CHILD: function( type, what, _argument, first, last ) {
                      var simple = type.slice( 0, 3 ) !== "nth",
                          forward = type.slice( -4 ) !== "last",
                          ofType = what === "of-type";
          
          
          Severity: Major
          Found in resources/lib/jquery/jquery.js - About 2 hrs to fix

            Function toggle has 73 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            OO.ui.PopupWidget.prototype.toggle = function ( show ) {
                show = show === undefined ? !this.isVisible() : !!show;
            
                const change = show !== this.isVisible();
            
            
            Severity: Major
            Found in resources/lib/ooui/oojs-ui-core.js - About 2 hrs to fix

              Method write has 73 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  #[\ReturnTypeWillChange]
                  public function write( $id, $dataStr ) {
                      if ( self::$instance !== $this ) {
                          throw new \UnexpectedValueException( __METHOD__ . ': Wrong instance called!' );
                      }
              Severity: Major
              Found in includes/session/PHPSessionHandler.php - About 2 hrs to fix

                Method upsert has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function upsert( $table, array $rows, $uniqueKeys, array $set, $fname = __METHOD__ ) {
                        $uniqueKey = $this->platform->normalizeUpsertParams( $uniqueKeys, $rows );
                        if ( !$rows ) {
                            return true;
                        }
                Severity: Major
                Found in includes/libs/rdbms/database/Database.php - About 2 hrs to fix

                  Method dropDefaults has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private static function dropDefaults( $element, array $attribs ) {
                          // Whenever altering this array, please provide a covering test case
                          // in HtmlTest::provideElementsWithAttributesHavingDefaultValues
                          static $attribDefaults = [
                              'area' => [ 'shape' => 'rect' ],
                  Severity: Major
                  Found in includes/Html/Html.php - About 2 hrs to fix

                    Method getAllowedParams has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getAllowedParams() {
                            return [
                                'prop' => [
                                    ParamValidator::PARAM_ISMULTI => true,
                                    ParamValidator::PARAM_TYPE => [
                    Severity: Major
                    Found in includes/api/ApiQueryInfo.php - About 2 hrs to fix

                      Method run has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function run( $resultPageSet = null ) {
                              $pages = $this->getPageSet()->getGoodPages();
                              if ( $pages === [] ) {
                                  return; // nothing to do
                              }
                      Severity: Major
                      Found in includes/api/ApiQueryImages.php - About 2 hrs to fix

                        Method execute has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function execute( $par ) {
                                $this->checkPermissions();
                                $this->checkReadOnly();
                        
                                $output = $this->getOutput();
                        Severity: Major
                        Found in includes/specials/SpecialEditTags.php - About 2 hrs to fix

                          Method getRestrictionListHTML has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function getRestrictionListHTML( stdClass $row ) {
                                  $items = [];
                                  $linkRenderer = $this->getLinkRenderer();
                          
                                  foreach ( $this->restrictions as $restriction ) {
                          Severity: Major
                          Found in includes/specials/pagers/BlockListPager.php - About 2 hrs to fix

                            Method run has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function run( $title ) {
                                    $params = $this->getValidatedParams();
                                    if ( $params['older_than'] !== null && $params['newer_than'] !== null ) {
                                        throw new LocalizedHttpException(
                                            new MessageValue( 'rest-pagehistory-incompatible-params' ), 400 );
                            Severity: Major
                            Found in includes/Rest/Handler/PageHistoryHandler.php - About 2 hrs to fix

                              Method execute has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function execute() {
                                      $dbr = $this->getReplicaDB();
                              
                                      $endId = $dbr->newSelectQueryBuilder()
                                          ->select( 'MAX(old_id)' )
                              Severity: Major
                              Found in maintenance/storage/storageTypeStats.php - About 2 hrs to fix

                                Method processOptions has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    protected function processOptions() {
                                        $sink = null;
                                        $sinks = [];
                                
                                        $this->schemaVersion = WikiExporter::schemaVersion();
                                Severity: Major
                                Found in maintenance/includes/BackupDumper.php - About 2 hrs to fix

                                  Function setErrors has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  HtmlformChecker.prototype.setErrors = function ( valid, errors, forceReplacement ) {
                                      let $oldErrorBox,
                                          showFunc,
                                          $text,
                                          replace,
                                  Severity: Minor
                                  Found in resources/src/mediawiki.special.createaccount/HtmlformChecker.js - About 2 hrs to fix

                                  Cognitive Complexity

                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                  A method's cognitive complexity is based on a few simple rules:

                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                  • Code is considered more complex for each "break in the linear flow of the code"
                                  • Code is considered more complex when "flow breaking structures are nested"

                                  Further reading

                                  Function exports has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  module.exports = ( function () {
                                  
                                      /**
                                       * @classdesc Interact with the API of another MediaWiki site. mw.Foreign API creates
                                       * an object like {@link mw.Api}, but automatically handle everything required to communicate
                                  Severity: Minor
                                  Found in resources/src/mediawiki.ForeignApi/mediawiki.ForeignApi.core.js - About 2 hrs to fix

                                  Cognitive Complexity

                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                  A method's cognitive complexity is based on a few simple rules:

                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                  • Code is considered more complex for each "break in the linear flow of the code"
                                  • Code is considered more complex when "flow breaking structures are nested"

                                  Further reading

                                  Function internalCan has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      private function internalCan(
                                          string $rigor,
                                          string $action,
                                          PageIdentity $target,
                                          ?PermissionStatus $status,
                                  Severity: Minor
                                  Found in includes/Permissions/UserAuthority.php - About 2 hrs to fix

                                  Cognitive Complexity

                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                  A method's cognitive complexity is based on a few simple rules:

                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                  • Code is considered more complex for each "break in the linear flow of the code"
                                  • Code is considered more complex when "flow breaking structures are nested"

                                  Further reading

                                  Function loadRestrictions has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public function loadRestrictions(
                                          PageIdentity $page, int $flags = IDBAccessObject::READ_NORMAL
                                      ): void {
                                          $page->assertWiki( PageIdentity::LOCAL );
                                  
                                  
                                  Severity: Minor
                                  Found in includes/Permissions/RestrictionStore.php - About 2 hrs to fix

                                  Cognitive Complexity

                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                  A method's cognitive complexity is based on a few simple rules:

                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                  • Code is considered more complex for each "break in the linear flow of the code"
                                  • Code is considered more complex when "flow breaking structures are nested"

                                  Further reading

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language