Showing 11,545 of 11,545 total issues
Function run
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function run() {
$updateRowsPerQuery = MediaWikiServices::getInstance()->getMainConfig()->get(
MainConfigNames::UpdateRowsPerQuery );
$userId = $this->params['userId'];
$maxWatchlistId = $this->params['maxWatchlistId'];
- 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 getGrantDescriptionsWithClasses
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getGrantDescriptionsWithClasses( array $grants, $lang = null ): array {
$riskGroupsByGrant = $this->grantsInfo->getRiskGroupsByGrant( 'unknown' );
$grantDescriptions = $this->getGrantDescriptions( $grants, $lang );
$results = [];
foreach ( $grantDescriptions as $grant => $description ) {
- 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 uncacheUser
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function uncacheUser( UserIdentity $user ) {
$this->statsFactory->getCounter( 'WatchedItemStore_uncacheUser_total' )
->copyToStatsdAt( 'WatchedItemStore.uncacheUser' )
->increment();
$uncacheUserItemsTotal = $this->statsFactory->getCounter( 'WatchedItemStore_uncacheUser_items_total' )
- 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 getVisitingWatchersCondition
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getVisitingWatchersCondition(
IReadableDatabase $db,
array $targetsWithVisitThresholds
): string {
$missingTargets = [];
- 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 checkSpecialsAndNSPermissions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function checkSpecialsAndNSPermissions(
$action,
UserIdentity $user,
PermissionStatus $status,
$rigor,
- 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 getWatchedItemsForUser
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getWatchedItemsForUser( UserIdentity $user, array $options = [] ) {
if ( !$user->isRegistered() ) {
// TODO: should this just return an empty array or rather complain loud at this point
// as e.g. ApiBase::getWatchlistUser does?
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 getGrantsWikiText
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getGrantsWikiText( $grantsFilter, $lang = null ): string {
if ( is_string( $lang ) ) {
$lang = $this->languageFactory->getLanguage( $lang );
} elseif ( $lang === null ) {
$lang = $this->contentLanguage;
- 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 getProviders
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function getProviders() {
if ( $this->sessionProviders === null ) {
$this->sessionProviders = [];
$objectFactory = MediaWikiServices::getInstance()->getObjectFactory();
foreach ( $this->config->get( MainConfigNames::SessionProviders ) as $spec ) {
- 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 jsonToPhpDoc
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static function jsonToPhpDoc( $jsonSchemaType ) {
static $phpTypes = [
'array' => 'array',
'object' => 'array', // could be optional
'number' => 'float',
- 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 readAndDecode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function readAndDecode( SettingsFormat $format ): array {
$contents = AtEase::quietCall( 'file_get_contents', $this->path );
if ( $contents === false ) {
if ( !is_readable( $this->path ) ) {
- 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 resetId
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function resetId() {
if ( $this->provider->persistsSessionId() ) {
$oldId = (string)$this->id;
$restart = $this->usePhpSessionHandling && $oldId === session_id() &&
PHPSessionHandler::isEnabled();
- 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 newFromTitle
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function newFromTitle( PageIdentity $pageIdentity ): WikiPage {
if ( $pageIdentity instanceof WikiPage ) {
return $pageIdentity;
}
- 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 printSharedImageText
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function printSharedImageText() {
$out = $this->getContext()->getOutput();
$this->loadFile();
$descUrl = $this->getFile()->getDescriptionUrl();
- 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 detectDeprecatedConfig
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function detectDeprecatedConfig(): array {
$config = $this->getConfig();
$keys = $this->getDefinedConfigKeys();
$deprecated = [];
- 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 makeMetadataTable
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function makeMetadataTable( $metadata ) {
$r = $this->getContext()->msg( 'metadata-help' )->plain();
// Initial state of collapsible rows is collapsed
// see mediawiki.action.view.filepage.less and mediawiki.action.view.metadata module.
$r .= "<table id=\"mw_metadata\" class=\"mw_metadata collapsed\">\n";
- 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 setForceHTTPSCookie
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function setForceHTTPSCookie( $set, ?SessionBackend $backend, WebRequest $request ) {
if ( $this->getConfig()->get( MainConfigNames::ForceHTTPS ) ) {
// No need to send a cookie if the wiki is always HTTPS (T256095)
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 getStrategyForType
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static function getStrategyForType( $type ) {
if ( is_array( $type ) ) {
if ( in_array( 'array', $type ) ) {
$type = 'array';
} elseif ( in_array( 'object', $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 handleRequest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function handleRequest( $subPage, WebRequest $request, OutputPage $output ) {
// No matter what: The response is always public
$output->getRequest()->response()->header( 'Access-Control-Allow-Origin: *' );
if ( !$this->canHandleRequest( $subPage, $request ) ) {
- 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 getDuplicates
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getDuplicates() {
$this->loadFile();
if ( $this->mDupes !== null ) {
return $this->mDupes;
}
- 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 tryFileCache
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function tryFileCache() {
static $called = false;
if ( $called ) {
wfDebug( "Article::tryFileCache(): called twice!?" );
- 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"