wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Function processCompletionResults has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    protected function processCompletionResults( $search, SearchSuggestionSet $suggestions ) {
        // We over-fetched to determine pagination. Shrink back down if we have extra results
        // and mark if pagination is possible
        $suggestions->shrink( $this->limit );

Severity: Minor
Found in includes/search/SearchEngine.php - About 1 hr 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 defaultSearchBackend has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function defaultSearchBackend( $namespaces, $search, $limit, $offset ) {
        if ( !$namespaces ) {
            $namespaces = [ NS_MAIN ];
        }

Severity: Minor
Found in includes/search/PrefixSearch.php - About 1 hr 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 markPatrolled has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function markPatrolled( Authority $performer, $tags = null ): PermissionStatus {
        $services = MediaWikiServices::getInstance();
        $mainConfig = $services->getMainConfig();
        $useRCPatrol = $mainConfig->get( MainConfigNames::UseRCPatrol );
        $useNPPatrol = $mainConfig->get( MainConfigNames::UseNPPatrol );
Severity: Minor
Found in includes/recentchanges/RecentChange.php - About 1 hr 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 fetchScriptList has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    protected function fetchScriptList() {
        $data = [
            'action' => 'query',
            'format' => 'json',
            'list' => 'allpages',
Severity: Minor
Found in maintenance/importSiteScripts.php - About 1 hr 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 readDump has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    protected function readDump( $input ) {
        $this->buffer = "";
        $this->openElement = false;
        $this->atStart = true;
        $this->state = "";
Severity: Minor
Found in maintenance/includes/TextPassDumper.php - About 1 hr 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 resolveStub has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function resolveStub( $row, $dryRun ) {
        $id = $row->old_id;
        $stub = unserialize( $row->old_text );
        $flags = SqlBlobStore::explodeFlags( $row->old_flags );

Severity: Minor
Found in maintenance/storage/resolveStubs.php - About 1 hr 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 endElement has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    protected function endElement( $parser, $name ) {
        $this->checkpointJustWritten = false;

        if ( $this->openElement ) {
            $this->clearOpenElement( "" );
Severity: Minor
Found in maintenance/includes/TextPassDumper.php - About 1 hr 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 validate has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate() {
        $valid = true;
        # Check to make sure we've got all the required options
        foreach ( $this->mOptDefs as $opt => $info ) {
            if ( $info['require'] && !$this->hasOption( $opt ) ) {
Severity: Minor
Found in maintenance/includes/MaintenanceParameters.php - About 1 hr 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 rebuildRecentChangesTablePass2 has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    private function rebuildRecentChangesTablePass2() {
        $dbw = $this->getPrimaryDB();

        $this->output( "Updating links and size differences...\n" );

Severity: Minor
Found in maintenance/rebuildrecentchanges.php - About 1 hr 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 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        global $IP;

        if ( $this->hasOption( 'help' ) ) {
            $this->maybeHelp();
Severity: Minor
Found in maintenance/install.php - About 1 hr 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 readChars has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function readChars( $callback ) {
        $this->getBlocks();
        $this->currentBlock = reset( $this->blocks );
        $xml = $this->open();
        $this->callback = $callback;
Severity: Minor
Found in maintenance/language/generateCollationData.php - About 1 hr 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 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        global $IP;

        $data = [];

Severity: Minor
Found in maintenance/mediawiki.Title/generatePhpCharToUpperMappings.php - About 1 hr 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 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $this->dataDir = $this->getOption( 'data-dir', '.' );

        $allkeysPresent = file_exists( "{$this->dataDir}/allkeys.txt" );
        $ucdallPresent = file_exists( "{$this->dataDir}/ucd.all.grouped.xml" );
Severity: Minor
Found in maintenance/language/generateCollationData.php - About 1 hr 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 updateOptions has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    private function updateOptions() {
        $dryRun = $this->hasOption( 'dry' );
        $settingWord = $dryRun ? 'Would set' : 'Setting';
        $option = $this->getArg( 0 );
        $fromIsDefault = $this->hasOption( 'old-is-default' );
Severity: Minor
Found in maintenance/userOptions.php - About 1 hr 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 fetchMessageInfo has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    protected function fetchMessageInfo( $langCode, array &$messageInfo ) {
        $services = $this->getServiceContainer();
        $contLang = $services->getContentLanguage();
        if ( $langCode ) {
            $this->output( "\n... fetching message info for language: $langCode" );
Severity: Minor
Found in maintenance/deleteEqualMessages.php - About 1 hr 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 13 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $config = $this->getConfig();
        $objectCaches = $config->get( MainConfigNames::ObjectCaches );

        $cacheType = $this->getOption( 'cache', $config->get( MainConfigNames::MainCacheType ) );
Severity: Minor
Found in maintenance/mctest.php - About 1 hr 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 handleBatch has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    private function handleBatch( int $lowId ): array {
        $migratedCount = 0;
        $res = $this->dbw->newSelectQueryBuilder()
            ->select( '*' )
            ->from( 'ipblocks' )
Severity: Minor
Found in maintenance/migrateBlocks.php - About 1 hr 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 doPerfTest has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    protected function doPerfTest( FileBackend $backend ) {
        $ops1 = [];
        $ops2 = [];
        $ops3 = [];
        $ops4 = [];
Severity: Minor
Found in maintenance/fileOpPerfTest.php - About 1 hr 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 movePage has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    private function movePage( $id, LinkTarget $newLinkTarget ) {
        $dbw = $this->getPrimaryDB();

        $dbw->newUpdateQueryBuilder()
            ->update( 'page' )
Severity: Minor
Found in maintenance/namespaceDupes.php - About 1 hr 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 scanRevisionsByTimestamp has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    private function scanRevisionsByTimestamp( $fromTimestamp, $total ) {
        $count = 0;
        $lastRevId = 0;
        $firstRevId = 0;
        $lastTimestamp = $fromTimestamp;
Severity: Minor
Found in maintenance/findBadBlobs.php - About 1 hr 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