wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Function saveOptions has 62 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        saveOptions: function ( options, params ) {
            const grouped = [];

            // Logged-out users can't have user options; we can't depend on mw.user, that'd be circular
            if ( mw.config.get( 'wgUserName' ) === null || mw.config.get( 'wgUserIsTemp' ) ) {
Severity: Major
Found in resources/src/mediawiki.api/options.js - About 2 hrs to fix

    Function getParamRepresentation has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    FilterGroup.prototype.getParamRepresentation = function ( filterRepresentation ) {
        let areAnySelected = false;
        const buildFromCurrentState = !filterRepresentation,
            defaultFilters = this.getDefaultFilters(),
            result = {},
    Severity: Major
    Found in resources/src/mediawiki.rcfilters/dm/FilterGroup.js - About 2 hrs to fix

      Method validate has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function validate( $path ) {
              $contents = file_get_contents( $path );
              $jsonParser = new JsonParser();
              try {
                  $data = $jsonParser->parse( $contents, JsonParser::DETECT_KEY_CONFLICTS );
      Severity: Major
      Found in includes/registration/ExtensionJsonValidator.php - About 2 hrs to fix

        Method shouldExecute has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function shouldExecute(): bool {
                $maxDepth = $this->options->get( MainConfigNames::RevertedTagMaxDepth );
                if (
                    !in_array( ChangeTags::TAG_REVERTED, $this->changeTagsStore->getSoftwareTags() ) ||
                    $maxDepth <= 0
        Severity: Major
        Found in includes/Storage/RevertedTagUpdate.php - About 2 hrs to fix

          Method actuallyNotifyOnPageChange has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function actuallyNotifyOnPageChange(
                  Authority $editor,
                  $title,
                  $timestamp,
                  $summary,
          Severity: Major
          Found in includes/mail/EmailNotification.php - About 2 hrs to fix

            Method consistencyCheck has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function consistencyCheck( array $paths ) {
                    $status = $this->newStatus();
                    if ( $this->syncChecks == 0 || count( $this->backends ) <= 1 ) {
                        return $status; // skip checks
                    }
            Severity: Major
            Found in includes/libs/filebackend/FileBackendMultiWrite.php - About 2 hrs to fix

              File XmlTypeCheck.php has 270 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/libs/mime/XmlTypeCheck.php - About 2 hrs to fix

                Method getButtons has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getButtons() {
                        $buttons = '';
                
                        if ( $this->mShowSubmit ) {
                            $attribs = [
                Severity: Major
                Found in includes/htmlform/OOUIHTMLForm.php - About 2 hrs to fix

                  Method getContributors has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function getContributors( $cnt, $showIfMax ) {
                          $contributors = $this->getWikiPage()->getContributors();
                  
                          $others_link = false;
                  
                  
                  Severity: Major
                  Found in includes/actions/CreditsAction.php - About 2 hrs to fix

                    Method __construct has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function __construct( $params ) {
                            $this->mParams = $params;
                    
                            if ( isset( $params['parent'] ) && $params['parent'] instanceof HTMLForm ) {
                                $this->mParent = $params['parent'];
                    Severity: Major
                    Found in includes/htmlform/HTMLFormField.php - About 2 hrs to fix

                      Method displaySection has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function displaySection( $fields,
                              $sectionName = '',
                              $fieldsetIDPrefix = '',
                              &$hasUserVisibleFields = false
                          ) {
                      Severity: Major
                      Found in includes/htmlform/HTMLForm.php - About 2 hrs to fix

                        Method convertNewsCode has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function convertNewsCode( $val ) {
                                if ( !preg_match( '/^\d{8}$/D', $val ) ) {
                                    // Not a valid news code.
                                    return $val;
                                }
                        Severity: Major
                        Found in includes/media/FormatMetadata.php - About 2 hrs to fix

                          Method wfEscapeWikiText has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function wfEscapeWikiText( $input ): string {
                              global $wgEnableMagicLinks;
                              static $repl = null, $repl2 = null, $repl3 = null, $repl4 = null;
                              if ( $repl === null || defined( 'MW_PARSER_TEST' ) || defined( 'MW_PHPUNIT_TEST' ) ) {
                                  // Tests depend upon being able to change $wgEnableMagicLinks, so don't cache
                          Severity: Major
                          Found in includes/GlobalFunctions.php - About 2 hrs to fix

                            Method getCommentInternal has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function getCommentInternal( ?IReadableDatabase $db, $key, $row, $fallback = false ) {
                                    $row = (array)$row;
                                    if ( array_key_exists( "{$key}_text", $row ) && array_key_exists( "{$key}_data", $row ) ) {
                                        $cid = $row["{$key}_cid"] ?? null;
                                        $text = $row["{$key}_text"];
                            Severity: Major
                            Found in includes/CommentStore/CommentStore.php - About 2 hrs to fix

                              Method getIP has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function getIP(): string {
                                      global $wgUsePrivateIPs;
                              
                                      # Return cached result
                                      if ( $this->ip !== null ) {
                              Severity: Major
                              Found in includes/Request/WebRequest.php - About 2 hrs to fix

                                Method checkVerification has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    protected function checkVerification( array $verification ) {
                                        switch ( $verification['status'] ) {
                                            // Recoverable errors
                                            case UploadBase::MIN_LENGTH_PARTNAME:
                                                $this->dieRecoverableError( [ 'filename-tooshort' ], 'filename' );
                                Severity: Major
                                Found in includes/api/ApiUpload.php - About 2 hrs to fix

                                  Method compress has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      private function compress() {
                                          if ( !function_exists( 'xdiff_string_rabdiff' ) ) {
                                              throw new RuntimeException( "Need xdiff support to write DiffHistoryBlob\n" );
                                          }
                                          if ( isset( $this->mDiffs ) ) {
                                  Severity: Major
                                  Found in includes/historyblob/DiffHistoryBlob.php - About 2 hrs to fix

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

                                        public function execute() {
                                            $pages = $this->getPageSet()->getGoodPages();
                                            if ( $pages === [] ) {
                                                return;
                                            }
                                    Severity: Major
                                    Found in includes/api/ApiQueryExternalLinks.php - About 2 hrs to fix

                                      Method logRequest has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          protected function logRequest( $time, Throwable $e = null ) {
                                              $request = $this->getRequest();
                                      
                                              $user = $this->getUser();
                                              $performer = [
                                      Severity: Major
                                      Found in includes/api/ApiMain.php - About 2 hrs to fix

                                        Method getRlClient has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            public function getRlClient() {
                                                if ( !$this->rlClient ) {
                                                    $context = $this->getRlClientContext();
                                                    $rl = $this->getResourceLoader();
                                                    $this->addModules( [
                                        Severity: Major
                                        Found in includes/Output/OutputPage.php - About 2 hrs to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language