wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Function provideSessionInfo has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function provideSessionInfo( WebRequest $request ) {
        $sessionId = $this->getCookie( $request, $this->params['sessionName'], '' );
        $info = [
            'provider' => $this,
            'forceHTTPS' => $this->getCookie( $request, 'forceHTTPS', '', false )
Severity: Minor
Found in includes/session/CookieSessionProvider.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 readFileInfo has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function readFileInfo( Context $context, array &$fileInfo ) {
        // Turn any 'filePath' or 'callback' key into actual 'content',
        // and remove the key after that. The callback could return a
        // FilePath object; if that happens, fall through to the 'filePath'
        // handling.
Severity: Minor
Found in includes/ResourceLoader/FileModule.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 saveModuleDependenciesInternal has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function saveModuleDependenciesInternal( $moduleName, $variant, $paths, $priorPaths ) {
        $hasPendingUpdate = (bool)$this->depStoreUpdateBuffer;
        $entity = "$moduleName|$variant";

        if ( array_diff( $paths, $priorPaths ) || array_diff( $priorPaths, $paths ) ) {
Severity: Minor
Found in includes/ResourceLoader/ResourceLoader.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 addCodeEditingIntro has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function addCodeEditingIntro(
        IntroMessageList $messages,
        MessageLocalizer $localizer,
        Title $title,
        Authority $performer
Severity: Minor
Found in includes/editpage/IntroMessageBuilder.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 getMultiNotice has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function getMultiNotice() {
        // The notice only make sense if we are diffing two saved revisions of the same page.
        if (
            !$this->mOldRevisionRecord || !$this->mNewRevisionRecord
            || !$this->mOldPage || !$this->mNewPage
Severity: Minor
Found in includes/diff/DifferenceEngine.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 userCanBitfield has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public static function userCanBitfield( $bitfield, $field, Authority $performer, PageIdentity $page = null ) {
        if ( $bitfield & $field ) { // aspect is deleted
            if ( $bitfield & self::DELETED_RESTRICTED ) {
                $permissions = [ 'suppressrevision', 'viewsuppressed' ];
            } elseif ( $field & self::DELETED_TEXT ) {
Severity: Minor
Found in includes/Revision/RevisionRecord.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 loadSlotContent has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function loadSlotContent(
        SlotRecord $slot,
        ?string $blobData = null,
        ?string $blobFlags = null,
        ?string $blobFormat = null,
Severity: Minor
Found in includes/Revision/RevisionStore.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 doGetFileContentsMulti has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected function doGetFileContentsMulti( array $params ) {
        $ep = array_diff_key( $params, [ 'srcs' => 1 ] ); // for error logging
        // Blindly create tmp files and stream to them, catching any exception
        // if the file does not exist. Do not waste time doing file stats here.
        $reqs = []; // (path => op)
Severity: Minor
Found in includes/libs/filebackend/SwiftFileBackend.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 doGetLocalCopyMulti has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected function doGetLocalCopyMulti( array $params ) {
        $ep = array_diff_key( $params, [ 'srcs' => 1 ] ); // for error logging
        // Blindly create tmp files and stream to them, catching any exception
        // if the file does not exist. Do not waste time doing file stats here.
        $reqs = []; // (path => op)
Severity: Minor
Found in includes/libs/filebackend/SwiftFileBackend.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 parse has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public static function parse( $value, $options = 0 ) {
        if ( $options & self::STRIP_COMMENTS ) {
            $value = self::stripComments( $value );
        }
        $assoc = ( $options & self::FORCE_ASSOC ) !== 0;
Severity: Minor
Found in includes/json/FormatJson.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 resolveStoragePath has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    final protected function resolveStoragePath( $storagePath ) {
        [ $backend, $shortCont, $relPath ] = self::splitStoragePath( $storagePath );
        if ( $backend === $this->name ) { // must be for this backend
            $relPath = self::normalizeContainerPath( $relPath );
            if ( $relPath !== null && self::isValidShortContainerName( $shortCont ) ) {
Severity: Minor
Found in includes/libs/filebackend/FileBackendStore.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 updateOpStats has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected function updateOpStats( string $op, array $keyInfo ) {
        $deltasByMetric = [];

        foreach ( $keyInfo as $indexOrKey => $keyOrSizes ) {
            if ( is_array( $keyOrSizes ) ) {
Severity: Minor
Found in includes/libs/objectcache/MediumSpecificBagOStuff.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 get_sock has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    function get_sock( $key ) {
        if ( !$this->_active ) {
            return false;
        }

Severity: Minor
Found in includes/libs/objectcache/utils/MemcachedClient.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 primaryPosWait has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function primaryPosWait( IDatabase $conn, DBPrimaryPos $pos, $timeout ) {
        if ( !( $pos instanceof MySQLPrimaryPos ) ) {
            throw new InvalidArgumentException( "Position not an instance of MySQLPrimaryPos" );
        }

Severity: Minor
Found in includes/libs/rdbms/database/replication/MysqlReplicationReporter.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 getPrimaryPos has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function getPrimaryPos( IDatabase $conn ) {
        $now = microtime( true ); // as-of-time *before* fetching GTID variables

        $pos = false;
        if ( $this->useGTIDs() ) {
Severity: Minor
Found in includes/libs/rdbms/database/replication/MysqlReplicationReporter.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 reconfigure has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function reconfigure( array $params ) {
        $anyServerDepooled = false;

        $paramServers = $params['servers'];
        $newIndexByServerIndex = $this->serverInfo->reconfigureServers( $paramServers );
Severity: Minor
Found in includes/libs/rdbms/loadbalancer/LoadBalancer.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 placeBlockUnsafe has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function placeBlockUnsafe( bool $reblock = false ): Status {
        $status = $this->blockUtils->validateTarget( $this->target );

        if ( !$status->isOK() ) {
            $this->logger->debug( 'placeBlockUnsafe: invalid target' );
Severity: Minor
Found in includes/block/BlockUser.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 doBatchLookups has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected function doBatchLookups() {
        # Do a link batch query
        $this->mResult->seek( 0 );
        $parentRevIds = [];
        $this->mParentLens = [];
Severity: Minor
Found in includes/pager/ContributionsPager.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 getPortletsTemplateData has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function getPortletsTemplateData() {
        if ( $this->portletsCached ) {
            return $this->portletsCached;
        }
        $portlets = [];
Severity: Minor
Found in includes/skins/SkinTemplate.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 inDnsBlacklist has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function inDnsBlacklist( $ip, array $bases ) {
        $found = false;
        // @todo FIXME: IPv6 ???  (https://bugs.php.net/bug.php?id=33170)
        if ( IPUtils::isIPv4( $ip ) ) {
            // Reverse IP, T23255
Severity: Minor
Found in includes/block/BlockManager.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

Severity
Category
Status
Source
Language