Showing 11,545 of 11,545 total issues
Function getProtectionInfo
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private function getProtectionInfo() {
$this->protections = [];
$db = $this->getDB();
// Get normal protections for existing titles
- 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 performUpload
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
protected function performUpload( $warnings ) {
// Use comment as initial page text by default
$this->mParams['text'] ??= $this->mParams['comment'];
/** @var LocalFile $file */
- 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 execute
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$user = $this->getUserForUpdatesOrNull();
if ( !$user || !$user->isNamed() ) {
$this->dieWithError(
[ 'apierror-mustbeloggedin', $this->msg( 'action-editmyoptions' ) ], 'notloggedin'
- 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 __construct
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( $context = null, $enableWrite = false, $internal = null ) {
if ( $context === null ) {
$context = RequestContext::getMain();
} elseif ( $context instanceof WebRequest ) {
// BC for pre-1.19
- 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 processIndividual
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
protected function processIndividual( $type, $params, $id ) {
$user = $this->getUser();
$idResult = [ $type => $id ];
// validate the ID
- 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 getModuleSourceInfo
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
protected function getModuleSourceInfo() {
if ( $this->mModuleSource !== false ) {
return $this->mModuleSource;
}
- 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 addWarningOrError
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
protected function addWarningOrError( $tag, $modulePath, $msg ) {
$value = self::stripMarkup( $msg->text() );
if ( $tag === 'error' ) {
// In BC mode, only one 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 formatRevisionRow
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
protected function formatRevisionRow( $row, $earliestLiveTime, $remaining ) {
$revRecord = $this->revisionStore->newRevisionFromArchiveRow(
$row,
IDBAccessObject::READ_NORMAL,
$this->mTargetObj
- 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 getBlockListPager
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
protected function getBlockListPager() {
$conds = [];
$db = $this->getDB();
if ( $this->target !== '' ) {
- 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 parseParams
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
protected function parseParams( $par ) {
$bits = preg_split( '/\s*,\s*/', trim( $par ) );
foreach ( $bits as $bit ) {
$m = [];
if ( $bit === 'shownav' ) {
- 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 showPermissionInternal
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function showPermissionInternal( array $messages, $action = null ) {
$services = MediaWikiServices::getInstance();
$groupPermissionsLookup = $services->getGroupPermissionsLookup();
// For some actions (read, edit, create and upload), display a "login to do this action"
- 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 save
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function save(
ParserOutput $parserOutput,
PageRecord $page,
$popts,
$cacheTime = 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 displaytitle
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public static function displaytitle( $parser, $text = '', $uarg = '' ) {
$restrictDisplayTitle = MediaWikiServices::getInstance()->getMainConfig()
->get( MainConfigNames::RestrictDisplayTitle );
static $magicWords = 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 mergeMapStrategy
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private static function mergeMapStrategy( array $a, array $b ): array {
foreach ( $b as $key => $bValue ) {
if ( !array_key_exists( $key, $a ) ) {
$a[$key] = $bValue;
} elseif (
- 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 getWhere
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function getWhere( IReadableDatabase $db, $key, $users, $useId = true ) {
$this->checkDeprecation( $key );
$tables = [];
$conds = [];
- 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 verifyFile
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
protected function verifyFile() {
$config = MediaWikiServices::getInstance()->getMainConfig();
$verifyMimeType = $config->get( MainConfigNames::VerifyMimeType );
$disableUploadScriptChecks = $config->get( MainConfigNames::DisableUploadScriptChecks );
$status = $this->verifyPartialFile();
- 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 getBackendPaths
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function getBackendPaths( array $paths, $latest = true ) {
$db = $this->getDB( $latest ? DB_PRIMARY : DB_REPLICA );
// @TODO: batching
$resolved = [];
- 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 detectVirus
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public static function detectVirus( $file ) {
global $wgOut;
$mainConfig = MediaWikiServices::getInstance()->getMainConfig();
$antivirus = $mainConfig->get( MainConfigNames::Antivirus );
$antivirusSetup = $mainConfig->get( MainConfigNames::AntivirusSetup );
- 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 buildPageObjects
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private function buildPageObjects( array $searchResponse ): array {
$pageInfos = [];
foreach ( $searchResponse as $response ) {
$isSearchResult = $response instanceof SearchResult;
if ( $isSearchResult ) {
- 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 checkPolicies
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private function checkPolicies( UserIdentity $user, $password, $policies, $policyCheckFunctions ) {
$status = Status::newGood( [] );
$forceChange = false;
$suggestChangeOnLogin = false;
$legacyUser = MediaWikiServices::getInstance()
- 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"