Showing 11,545 of 11,545 total issues
Function __construct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( $value, ...$values ) {
if ( !is_string( $value ) && !( $value instanceof LikeMatch ) ) {
$type = get_debug_type( $value );
throw new InvalidArgumentException( "\$value must be string or LikeMatch, got $type" );
}
- Read upRead up
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 reportConnectionError
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function reportConnectionError( $extraLbError = '' ) {
if ( $this->lastErrorConn instanceof IDatabaseForOwner ) {
$srvName = $this->lastErrorConn->getServerName();
$lastDbError = $this->lastErrorConn->lastError() ?: 'unknown error';
- Read upRead up
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 getOpenConnections
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getOpenConnections() {
foreach ( $this->conns as $poolConnsByServer ) {
foreach ( $poolConnsByServer as $serverConns ) {
foreach ( $serverConns as $conn ) {
yield $conn;
- Read upRead up
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 persistSessionReplicationPositions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function persistSessionReplicationPositions( &$clientPosIndex = null ) {
$this->load();
if ( !$this->enabled ) {
return [];
}
- Read upRead up
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 getDefaultValueDeclarationSQL
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getDefaultValueDeclarationSQL( $column ) {
$type = $column['type'];
$default = $column['default'] ?? null;
if ( $type instanceof TimestampType && $default ) {
- Read upRead up
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 closeConnection
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function closeConnection( IDatabaseForOwner $conn ) {
if ( $conn instanceof DBConnRef ) {
// Avoid calling close() but still leaving the handle in the pool
throw new RuntimeException( 'Cannot close DBConnRef instance; it must be shareable' );
}
- Read upRead up
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 getSQLDeclaration
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getSQLDeclaration( array $fieldDeclaration, AbstractPlatform $platform ) {
if ( $platform->getName() == 'mysql' ) {
// "infinite" (in expiry values has to be VARBINARY)
if ( isset( $fieldDeclaration['allowInfinite'] ) && $fieldDeclaration['allowInfinite'] ) {
return 'VARBINARY(14)';
- Read upRead up
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 load
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function load() {
// Not enabled or already loaded, short-circuit.
if ( !$this->enabled || $this->clientId ) {
return;
}
- Read upRead up
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 getReaderIndex
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getReaderIndex( $group = false ) {
$group = is_string( $group ) ? $group : self::GROUP_GENERIC;
if ( !$this->serverInfo->hasReplicaServers() ) {
// There is only one possible server to use (the primary)
- Read upRead up
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 getBlockErrorMessageKey
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getBlockErrorMessageKey( Block $block, UserIdentity $user ) {
$isTempUser = $this->userIdentityUtils->isTemp( $user );
$key = $isTempUser ? 'blockedtext-tempuser' : 'blockedtext';
if ( $block instanceof DatabaseBlock ) {
if ( $block->getType() === Block::TYPE_AUTO ) {
- Read upRead up
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 getRangeCond
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getRangeCond( $start, $end, $schema = self::SCHEMA_BLOCK ) {
// Per T16634, we want to include relevant active range blocks; for
// range blocks, we want to include larger ranges which enclose the given
// range. We know that all blocks must be smaller than $wgBlockCIDRLimit,
// so we can improve performance by filtering on a LIKE clause
- Read upRead up
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 getSystemIpBlocks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getSystemIpBlocks( string $ip, bool $applySoftBlocks ): array {
$blocks = [];
// Proxy blocking
if ( !in_array( $ip, $this->options->get( MainConfigNames::ProxyWhitelist ) ) ) {
- Read upRead up
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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function update( array $restrictions ) {
$dbw = $this->dbProvider->getPrimaryDatabase( $this->wikiId );
$dbw->startAtomic( __METHOD__ );
- Read upRead up
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 reallyDoQuery
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function reallyDoQuery( $offset, $limit, $order ) {
[ $tables, $fields, $conds, $fname, $options, $join_conds ] = $this->buildQueryInfo(
$offset,
$limit,
$order
- Read upRead up
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 findRestriction
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function findRestriction( $type, $value ) {
$restrictions = $this->getRestrictions();
foreach ( $restrictions as $restriction ) {
if ( $restriction->getType() !== $type ) {
continue;
- Read upRead up
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 prepareQuickTemplate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function prepareQuickTemplate() {
$title = $this->getTitle();
$request = $this->getRequest();
$out = $this->getOutput();
$config = $this->getConfig();
- Read upRead up
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 shouldDoHttpRedirect
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function shouldDoHttpRedirect() {
$request = $this->context->getRequest();
// Don't redirect if we're already on HTTPS
if ( $request->getProtocol() !== 'http' ) {
- Read upRead up
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 getSpecialPageAssociatedNavigationLinks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getSpecialPageAssociatedNavigationLinks( Title $title ): array {
$specialAssociatedNavigationLinks = [];
$specialFactory = MediaWikiServices::getInstance()->getSpecialPageFactory();
$special = $specialFactory->getPage( $title->getText() );
if ( $special === null ) {
- Read upRead up
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 getReturnToParam
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function getReturnToParam( $title, $request, $authority ) {
# Due to T34276, if a user does not have read permissions,
# $this->getTitle() will just give Special:Badtitle, which is
# not especially useful as a returnto parameter. Use the title
# from the request instead, if there was one.
- Read upRead up
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 makeLink
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function makeLink( $text, array $query = null, $type = null ) {
$attrs = [];
if ( $query !== null && in_array( $type, [ 'prev', 'next' ] ) ) {
$attrs['rel'] = $type;
}
- Read upRead up
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"