wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Method __construct has 14 arguments (exceeds 4 allowed). Consider refactoring.
Open

        ILoadBalancer $loadBalancer,
        SqlBlobStore $blobStore,
        WANObjectCache $cache,
        BagOStuff $localCache,
        CommentStore $commentStore,
Severity: Major
Found in includes/Revision/RevisionStore.php - About 1 hr to fix

    Function getLocations has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getLocations( $item, $limit, $from = self::RING_ALL ) {
            if ( $from === self::RING_ALL ) {
                $ring = $this->baseRing;
            } elseif ( $from === self::RING_LIVE ) {
                $ring = $this->getLiveRing();
    Severity: Minor
    Found in includes/libs/HashRing.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 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function validate( $name, $value, array $settings, array $options ) {
            if ( is_int( $value ) ) {
                $ret = $value;
            } elseif ( is_float( $value ) ) {
                // Since JSON does not distinguish between integers and floats,
    Severity: Minor
    Found in includes/libs/ParamValidator/TypeDef/IntegerDef.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 getLiveRing has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function getLiveRing() {
            if ( !$this->ejectExpiryByLocation ) {
                return $this->baseRing; // nothing ejected
            }
    
    
    Severity: Minor
    Found in includes/libs/HashRing.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 doExecuteOpHandlesInternal has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function doExecuteOpHandlesInternal( array $fileOpHandles ) {
            /** @var SwiftFileOpHandle[] $fileOpHandles */
            '@phan-var SwiftFileOpHandle[] $fileOpHandles';
    
            /** @var StatusValue[] $statuses */
    Severity: Minor
    Found in includes/libs/filebackend/SwiftFileBackend.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 doQuickOperationsInternal has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        final protected function doQuickOperationsInternal( array $ops, array $opts ) {
            /** @noinspection PhpUnusedLocalVariableInspection */
            $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
            $status = $this->newStatus();
    
    
    Severity: Minor
    Found in includes/libs/filebackend/FileBackendStore.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 cartesianProduct has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function cartesianProduct( ...$inputArrays ) {
            $numInputs = count( $inputArrays );
            if ( $numInputs === 0 ) {
                return [];
            }
    Severity: Minor
    Found in includes/libs/ArrayUtils.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 detectMimeType has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        private function detectMimeType( string $file, $ext = true ): string {
            /** @todo Make $ext default to false. Or better, remove it. */
            if ( $ext ) {
                $this->logger->info( __METHOD__ .
                    ": WARNING: use of the \$ext parameter is deprecated. "
    Severity: Minor
    Found in includes/libs/mime/MimeAnalyzer.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 initializeClient has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        private function initializeClient( Memcached $client, array $params ) {
            if ( $client->getServerList() ) {
                $this->logger->debug( __METHOD__ . ": pre-initialized client instance." );
    
                return; // preserve persistent handle
    Severity: Minor
    Found in includes/libs/objectcache/MemcachedPeclBagOStuff.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 readDirectory has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        private function readDirectory() {
            $dirSectorId = $this->header['first_dir_sector'];
            $binaryDir = '';
            $seenSectorIds = [];
            while ( $dirSectorId !== 0xFFFFFFFE ) {
    Severity: Minor
    Found in includes/libs/mime/MSCompoundFileReader.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 selectFieldsOrOptionsAggregate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        private function selectFieldsOrOptionsAggregate( $fields, $options ) {
            foreach ( (array)$options as $key => $value ) {
                if ( is_string( $key ) ) {
                    if ( preg_match( '/^(?:GROUP BY|HAVING)$/i', $key ) ) {
                        return true;
    Severity: Minor
    Found in includes/libs/rdbms/platform/SQLPlatform.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 waitForReplication has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function waitForReplication( array $opts = [] ) {
            $opts += [
                'timeout' => $this->replicationWaitTimeout,
                'ifWritesSince' => null
            ];
    Severity: Minor
    Found in includes/libs/rdbms/lbfactory/LBFactory.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 handleErroredQuery has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        private function handleErroredQuery( QueryStatus $status, $sql, $fname, $queryRuntime, $priorSessInfo ) {
            $errflags = self::ERR_NONE;
            $error = $status->message;
            $errno = $status->code;
            if ( $status->res !== false ) {
    Severity: Minor
    Found in includes/libs/rdbms/database/Database.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 duplicateTableStructure has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function duplicateTableStructure(
            $oldName, $newName, $temporary = false, $fname = __METHOD__
        ) {
            $query = new Query(
                "SELECT sql FROM sqlite_master WHERE tbl_name=" .
    Severity: Minor
    Found in includes/libs/rdbms/database/DatabaseSqlite.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 getActiveGtidCoordinates has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function getActiveGtidCoordinates() {
            $gtidInfos = [];
    
            foreach ( $this->gtids as $gtid ) {
                [ $domain, $pos, $server ] = self::parseGTID( $gtid );
    Severity: Minor
    Found in includes/libs/rdbms/database/position/MySQLPrimaryPos.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 open has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function open( $server, $user, $password, $db, $schema, $tablePrefix ) {
            $this->close( __METHOD__ );
    
            if ( $schema !== null ) {
                throw $this->newExceptionAfterConnectError( "Got schema '$schema'; not supported." );
    Severity: Minor
    Found in includes/libs/rdbms/database/DatabaseMySQL.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 runPrimaryTransactionIdleCallbacks has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function runPrimaryTransactionIdleCallbacks( $fname = __METHOD__ ) {
            if ( $this->trxRoundStage === self::ROUND_COMMIT_CALLBACKS ) {
                $type = IDatabase::TRIGGER_COMMIT;
            } elseif ( $this->trxRoundStage === self::ROUND_ROLLBACK_CALLBACKS ) {
                $type = IDatabase::TRIGGER_ROLLBACK;
    Severity: Minor
    Found in includes/libs/rdbms/loadbalancer/LoadBalancer.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 acquireTarget has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        private function acquireTarget(
            DatabaseBlock $block,
            IDatabase $dbw,
            $expectedTargetCount
        ) {
    Severity: Minor
    Found in includes/block/DatabaseBlockStore.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 filter has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function filter( ?Block $block, $callback ) {
            if ( !$block ) {
                return null;
            } elseif ( $block instanceof CompositeBlock ) {
                $blocks = $block->getOriginalBlocks();
    Severity: Minor
    Found in includes/block/BlockManager.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 placeBlockInternal has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        private function placeBlockInternal( bool $reblock = true ): Status {
            $block = $this->configureBlock();
    
            $denyReason = [ 'hookaborted' ];
            $legacyUser = $this->userFactory->newFromAuthority( $this->performer );
    Severity: Minor
    Found in includes/block/BlockUser.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