wikimedia/mediawiki-core

View on GitHub

Showing 9,426 of 11,461 total issues

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

    public function execute() {
        // The data is hot but user-dependent, like page views, so we set vary cookies
        $this->getMain()->setCacheMode( 'anon-public-user-private' );

        // Get parameters
Severity: Major
Found in includes/api/ApiParse.php - About 2 days to fix

    File jquery.tablesorter.js has 879 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * TableSorter for MediaWiki
     *
     * Written 2011 Leo Koppelkamm
     * Based on tablesorter.com plugin, written (c) 2007 Christian Bach.
    Severity: Major
    Found in resources/src/jquery.tablesorter/jquery.tablesorter.js - About 2 days to fix

      Function execute has a Cognitive Complexity of 106 (exceeds 5 allowed). Consider refactoring.
      Open

          public function execute() {
              $params = $this->extractRequestParams();
      
              $prop = array_fill_keys( $params['prop'], true );
      
      
      Severity: Minor
      Found in includes/api/ApiQueryImageInfo.php - About 2 days 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

      File ImagePage.php has 872 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: Major
      Found in includes/page/ImagePage.php - About 2 days to fix

        Function buildContentNavigationUrlsInternal has a Cognitive Complexity of 105 (exceeds 5 allowed). Consider refactoring.
        Open

            private function buildContentNavigationUrlsInternal() {
                if ( $this->contentNavigationCached ) {
                    return $this->contentNavigationCached;
                }
                // Display tabs for the relevant title rather than always the title itself
        Severity: Minor
        Found in includes/skins/SkinTemplate.php - About 2 days 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

        File ApiUpload.php has 871 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * Copyright © 2008 - 2010 Bryan Tong Minh <Bryan.TongMinh@Gmail.com>
         *
         * This program is free software; you can redistribute it and/or modify
        Severity: Major
        Found in includes/api/ApiUpload.php - About 2 days to fix

          Method profilePreferences has 421 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function profilePreferences(
                  User $user, IContextSource $context, &$defaultPreferences
              ) {
                  // retrieving user name for GENDER and misc.
                  $userName = $user->getName();
          Severity: Major
          Found in includes/preferences/DefaultPreferencesFactory.php - About 2 days to fix

            ParserOptions has 109 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class ParserOptions {
            
                /**
                 * Default values for all options that are relevant for caching.
                 * @see self::getDefaults()
            Severity: Major
            Found in includes/parser/ParserOptions.php - About 2 days to fix

              Method pageInfo has 418 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function pageInfo() {
                      $user = $this->getUser();
                      $lang = $this->getLanguage();
                      $title = $this->getTitle();
                      $id = $title->getArticleID();
              Severity: Major
              Found in includes/actions/InfoAction.php - About 2 days to fix

                File FileModule.php has 858 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: Major
                Found in includes/ResourceLoader/FileModule.php - About 2 days to fix

                  File WikiImporter.php has 855 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /**
                   * MediaWiki page data importer.
                   *
                   * Copyright © 2003,2005 Brooke Vibber <bvibber@wikimedia.org>
                  Severity: Major
                  Found in includes/import/WikiImporter.php - About 2 days to fix

                    File mediawiki.jqueryMsg.js has 852 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /*!
                    * Experimental advanced wikitext parser-emitter.
                    * See: https://www.mediawiki.org/wiki/Extension:UploadWizard/MessageParser for docs
                    *
                    * @author neilk@wikimedia.org
                    Severity: Major
                    Found in resources/src/mediawiki.jqueryMsg/mediawiki.jqueryMsg.js - About 2 days to fix

                      Function run has a Cognitive Complexity of 102 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function run( $resultPageSet = null ) {
                              $user = $this->getUser();
                              /* Get the parameters of the request. */
                              $params = $this->extractRequestParams();
                      
                      
                      Severity: Minor
                      Found in includes/api/ApiQueryRecentChanges.php - About 2 days 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

                      File RecentChange.php has 850 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      /**
                       * Utility class for creating and accessing recent change entries.
                       *
                       * This program is free software; you can redistribute it and/or modify
                      Severity: Major
                      Found in includes/changes/RecentChange.php - About 2 days to fix

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

                            public function execute() {
                                $this->useTransactionalTimeLimit();
                        
                                $user = $this->getUser();
                                $params = $this->extractRequestParams();
                        Severity: Major
                        Found in includes/api/ApiEditPage.php - About 2 days to fix

                          File SpecialMovePage.php has 848 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: Major
                          Found in includes/specials/SpecialMovePage.php - About 2 days to fix

                            File PageUpdater.php has 837 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: Major
                            Found in includes/Storage/PageUpdater.php - About 2 days to fix

                              Function expand has a Cognitive Complexity of 100 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function expand( $root, $flags = 0 ) {
                                      static $expansionDepth = 0;
                                      if ( is_string( $root ) ) {
                                          return $root;
                                      }
                              Severity: Minor
                              Found in includes/parser/PPFrame_Hash.php - About 2 days 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

                              Method internalAttemptSave has 399 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function internalAttemptSave( &$result, $markAsBot = false, $markAsMinor = false ) {
                                      // If an attempt to acquire a temporary name failed, don't attempt to do anything else.
                                      if ( $this->unableToAcquireTempName ) {
                                          $status = Status::newFatal( 'temp-user-unable-to-acquire' );
                                          $status->value = self::AS_UNABLE_TO_ACQUIRE_TEMP_ACCOUNT;
                              Severity: Major
                              Found in includes/editpage/EditPage.php - About 1 day to fix

                                Function wikiTextToAst has 398 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    wikiTextToAst: function ( input ) {
                                        var pos,
                                            regularLiteral, regularLiteralWithoutBar, regularLiteralWithoutSpace, regularLiteralWithSquareBrackets,
                                            doubleQuote, singleQuote, backslash, anyCharacter, asciiAlphabetLiteral,
                                            escapedOrLiteralWithoutSpace, escapedOrLiteralWithoutBar, escapedOrRegularLiteral,
                                Severity: Major
                                Found in resources/src/mediawiki.jqueryMsg/mediawiki.jqueryMsg.js - About 1 day to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language