wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Function load has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function load( $flags = IDBAccessObject::READ_NORMAL ) {
        global $wgFullyInitialised;

        if ( $this->mLoadedItems === true ) {
            return;
Severity: Minor
Found in includes/user/User.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 clearInstanceCache has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function clearInstanceCache( $reloadFrom = false ) {
        global $wgFullyInitialised;

        $this->mDatePreference = null;
        $this->mHash = false;
Severity: Minor
Found in includes/user/User.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 limitTitle has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private function limitTitle( $page, $pattern ) {
        if ( !$page instanceof PageReference ) {
            // NOTE: For some types of logs, the title may be something strange, like "User:#12345"!
            $page = Title::newFromText( $page );
            if ( !$page ) {
Severity: Minor
Found in includes/logging/LogPager.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 generateThumbnail has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    protected function generateThumbnail( File $file, array $params, $thumbName, $thumbPath ) {
        $attemptFailureEpoch = $this->getConfig( MainConfigNames::AttemptFailureEpoch );

        $services = MediaWikiServices::getInstance()->getObjectCacheFactory();

Severity: Minor
Found in includes/filerepo/ThumbnailEntryPoint.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 findConflict has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private function findConflict( $node, $parts, $index = 0 ) {
        if ( $index >= count( $parts ) ) {
            // If we reached the leaf node then a conflict is detected
            return $node;
        }
Severity: Minor
Found in includes/Rest/PathTemplateMatcher/PathMatcher.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 getAll has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAll( $wiki, $site = null, $params = [], $wikiTags = [] ) {
        $params = $this->mergeParams( $wiki, $site, $params, $wikiTags );
        $tags = $params['tags'];
        $localSettings = [];
        foreach ( $this->settings as $varname => $overrides ) {
Severity: Minor
Found in includes/config/SiteConfiguration.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 insertElement has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function insertElement( $preposition, $refElement, Element $element, $void,
        $sourceStart, $sourceLength
    ) {
        [ $parent, $newRef ] = $this->getParentForInsert( $preposition, $refElement );
        $parentData = $parent->snData;
Severity: Minor
Found in includes/tidy/RemexCompatMunger.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 getHelp has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function getHelp(): string {
        $screenWidth = 80; // TODO: Calculate this!
        $tab = "    ";
        $descWidth = $screenWidth - ( 2 * strlen( $tab ) );

Severity: Minor
Found in maintenance/includes/MaintenanceParameters.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 deleteOptions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private function deleteOptions() {
        $dryRun = $this->hasOption( 'dry' );
        $option = $this->getArg( 0 );
        $fromUserId = (int)$this->getOption( 'fromuserid', 0 );
        $toUserId = (int)$this->getOption( 'touserid', 0 ) ?: null;
Severity: Minor
Found in maintenance/userOptions.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 execute has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $this->run = $this->getOption( 'run', false );

        if ( $this->run ) {
            $username = $this->getOption( 'user', User::MAINTENANCE_SCRIPT_USER );
Severity: Minor
Found in maintenance/uppercaseTitlesForUnicodeTransition.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 processUsers has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private function processUsers( IReadableDatabase $db ) {
        $userlistFile = $this->getOption( 'userlist' );
        if ( $userlistFile === null ) {
            $this->output( "Not generating user list, --userlist was not specified.\n" );
            return;
Severity: Minor
Found in maintenance/uppercaseTitlesForUnicodeTransition.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 execute has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $this->init();
        $batchSize = $this->getBatchSize();

        if ( $this->targetTable ) {
Severity: Minor
Found in maintenance/updateCollation.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 generateMessageFileList has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private function generateMessageFileList( array $setupFiles ) {
        $IP = MW_INSTALL_PATH;

        $outputFile = $this->getOption( 'output' );
        $quiet = $this->hasOption( 'quiet' );
Severity: Minor
Found in maintenance/mergeMessageFileList.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 execute has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $exampleKeys = [];
        $max = 100;
        $count = 500;
        while ( $count-- ) {
Severity: Minor
Found in maintenance/benchmarks/benchmarkLruHash.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 execute has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        // Settings we will display
        $res = [];

        # Default: dump any wg / wmg variable
Severity: Minor
Found in maintenance/getConfiguration.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

File jquery.ui.core.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * jQuery UI Core 1.9.2
 * http://jqueryui.com
 *
 * Copyright 2012 jQuery Foundation and other contributors
Severity: Minor
Found in resources/lib/jquery.ui/jquery.ui.core.js - About 2 hrs to fix

    File PageCommandFactory.php has 267 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/page/PageCommandFactory.php - About 2 hrs to fix

      File SetupDynamicConfig.php has 267 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * This is included by Setup.php to adjust the values of globals before services are initialized.
       * It's split into a separate file so it can be tested.
       */
      Severity: Minor
      Found in includes/SetupDynamicConfig.php - About 2 hrs to fix

        Function MwRcfiltersUiFilterWrapperWidget has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const FilterWrapperWidget = function MwRcfiltersUiFilterWrapperWidget(
            controller, model, savedQueriesModel, changesListModel, config
        ) {
            config = config || {};
        
        
        Severity: Major
        Found in resources/src/mediawiki.rcfilters/ui/FilterWrapperWidget.js - About 2 hrs to fix

          Function fn has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              fn(state) {
                return __async(this, null, function* () {
                  const {
                    x,
                    y,
          Severity: Major
          Found in resources/lib/codex/codex.js - About 2 hrs to fix
            Severity
            Category
            Status
            Source
            Language