wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

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

    public function execute( $par ) {
        $this->setHeaders();
        $this->addHelpLink( 'Help:Renameuser' );

        $this->checkPermissions();
Severity: Minor
Found in includes/specials/SpecialRenameUser.php - About 5 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 cleanUpTocLine has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    private function cleanUpTocLine( Node $container ) {
        '@phan-var Element|DocumentFragment $container';  // @var Element|DocumentFragment $container
        # Strip out HTML
        # Allowed tags are:
        # * <sup> and <sub> (T10393)
Severity: Minor
Found in includes/parser/Parser.php - About 5 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 replaceInternal has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    protected function replaceInternal( &$text ) {
        if ( !$this->internals ) {
            return;
        }

Severity: Minor
Found in includes/parser/LinkHolderArray.php - About 5 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 execute has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute(
        User $performingUser,
        $username = null,
        $email = null
    ) {
Severity: Minor
Found in includes/user/PasswordReset.php - About 5 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 getTrackingCategories has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    public function getTrackingCategories() {
        $categories = array_merge(
            self::CORE_TRACKING_CATEGORIES,
            $this->extensionRegistry->getAttribute( MainConfigNames::TrackingCategories ),
            $this->options->get( MainConfigNames::TrackingCategories ) // deprecated
Severity: Minor
Found in includes/Category/TrackingCategories.php - About 5 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

Method deleteInternal has 127 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function deleteInternal(
        WikiPage $page,
        string $pageRole,
        string $reason,
        ?string $webRequestId = null
Severity: Major
Found in includes/page/DeletePage.php - About 5 hrs to fix

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

        private function run( $resultPageSet = null ) {
            $params = $this->extractRequestParams();
    
            $user = $this->getUser();
            $wlowner = $this->getWatchlistUser( $params );
    Severity: Major
    Found in includes/api/ApiQueryWatchlist.php - About 5 hrs to fix

      File ForeignResourceManager.php has 377 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/ResourceLoader/ForeignResourceManager.php - About 5 hrs to fix

        File UsersPager.php has 377 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * Copyright © 2004 Brooke Vibber, lcrocker, Tim Starling,
         * Domas Mituzas, Antoine Musso, Jens Frank, Zhengzhu,
         * 2006 Rob Church <robchur@gmail.com>
        Severity: Minor
        Found in includes/specials/pagers/UsersPager.php - About 5 hrs to fix

          Function register_observers has 126 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              Chosen.prototype.register_observers = function() {
                this.container.on('touchstart.chosen', (function(_this) {
                  return function(evt) {
                    _this.container_mousedown(evt);
                  };
          Severity: Major
          Found in resources/lib/jquery.chosen/chosen.jquery.js - About 5 hrs to fix

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

                private function run( $resultPageSet = null ) {
                    $params = $this->extractRequestParams();
            
                    // Extract parameters
                    $query = $params['search'];
            Severity: Major
            Found in includes/api/ApiQuerySearch.php - About 5 hrs to fix

              Method getCurrentUserInfo has 126 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function getCurrentUserInfo() {
                      $user = $this->getUser();
                      $vals = [];
                      $vals['id'] = $user->getId();
                      $vals['name'] = $user->getName();
              Severity: Major
              Found in includes/api/ApiQueryUserInfo.php - About 5 hrs to fix

                Method checkLinkTable has 126 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function checkLinkTable( $table, $fieldPrefix, $ns, $name, $options,
                        $extraConds = []
                    ) {
                        $dbw = $this->getPrimaryDB();
                
                
                Severity: Major
                Found in maintenance/namespaceDupes.php - About 5 hrs to fix

                  File HTMLFormFieldCloner.php has 376 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  namespace MediaWiki\HTMLForm\Field;
                  
                  use InvalidArgumentException;
                  Severity: Minor
                  Found in includes/htmlform/fields/HTMLFormFieldCloner.php - About 5 hrs to fix

                    File MaintenanceParameters.php has 376 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 maintenance/includes/MaintenanceParameters.php - About 5 hrs to fix

                      SettingsBuilder has 38 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class SettingsBuilder {
                      
                          /**
                           * @var int The initial stage in which settings can be loaded,
                           * but config values cannot be accessed.
                      Severity: Minor
                      Found in includes/Settings/SettingsBuilder.php - About 5 hrs to fix

                        MemcachedClient has 38 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class MemcachedClient implements StorageAwareness {
                            // {{{ properties
                            // {{{ public
                        
                            // {{{ constants
                        Severity: Minor
                        Found in includes/libs/objectcache/utils/MemcachedClient.php - About 5 hrs to fix

                          ChangeTags has 38 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class ChangeTags {
                              /**
                               * The tagged edit changes the content model of the page.
                               */
                              public const TAG_CONTENT_MODEL_CHANGE = 'mw-contentmodelchange';
                          Severity: Minor
                          Found in includes/changetags/ChangeTags.php - About 5 hrs to fix

                            Site has 38 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            class Site {
                                public const TYPE_UNKNOWN = 'unknown';
                                public const TYPE_MEDIAWIKI = 'mediawiki';
                            
                                public const GROUP_NONE = 'none';
                            Severity: Minor
                            Found in includes/site/Site.php - About 5 hrs to fix

                              DatabaseInstaller has 38 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              abstract class DatabaseInstaller {
                                  /**
                                   * A connection for creating DBs, suitable for pre-installation.
                                   */
                                  public const CONN_CREATE_DATABASE = 'create-database';
                              Severity: Minor
                              Found in includes/installer/DatabaseInstaller.php - About 5 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language