Showing 11,545 of 11,545 total issues
Function save
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function save() {
# Permission check!
if ( $this->disabled ) {
$this->show();
return false;
- 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 getProperties
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function getProperties( $titles, $propertyNames ) {
if ( is_array( $propertyNames ) ) {
$gotArray = true;
} else {
$propertyNames = [ $propertyNames ];
- 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 loadAsComponents
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function loadAsComponents( bool $inlineReferences = false ): array {
$schemas = [];
$defs = [];
$obsolete = [];
- 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 getParserOutput
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function getParserOutput(
PageRecord $page,
ParserOptions $parserOptions,
?RevisionRecord $revision = null,
int $options = 0
- 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 getLessCompiler
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function getLessCompiler( array $vars = [], array $importDirs = [] ) {
// When called from the installer, it is possible that a required PHP extension
// is missing (at least for now; see T49564). If this is the case, throw an
// exception (caught by the installer) to prevent a fatal error later on.
if ( !class_exists( Less_Parser::class ) ) {
- 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 getAuthenticationRequestsInternal
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function getAuthenticationRequestsInternal(
$providerAction, array $options, array $providers, UserIdentity $user = null
) {
$user = $user ?: RequestContext::getMain()->getUser();
$options['username'] = $user->isRegistered() ? $user->getName() : 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 importFormData
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function importFormData( &$request ) {
# Section edit can come from either the form or a link
$this->section = $request->getVal( 'wpSection', $request->getVal( 'section', '' ) );
if ( $this->section !== null && $this->section !== '' && !$this->isSectionEditSupported() ) {
- 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 prefetch
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function prefetch( $page, $rev, $slot = SlotRecord::MAIN ) {
$page = intval( $page );
$rev = intval( $rev );
while ( $this->lastPage < $page && !$this->atEnd ) {
$this->debug( "BaseDump::prefetch at page $this->lastPage, looking for $page" );
- 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 tryReset
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
protected function tryReset( User $user, array $reqs ) {
$data = $this->manager->getAuthenticationSessionData( 'reset-pass' );
if ( !$data ) {
return AuthenticationResponse::newAbstain();
}
- 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 sendEmailUnsafe
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function sendEmailUnsafe(
UserEmailContact $target,
string $subject,
string $text,
bool $CCMe,
- 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 handleUpload
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function handleUpload( &$pageInfo ) {
$this->debug( "Enter upload handler" );
$uploadInfo = [];
$normalFields = [ 'timestamp', 'comment', 'filename', 'text',
- 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 convertGrammar
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function convertGrammar( $word, $case ) {
$grammarForms =
MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::GrammarForms );
if ( isset( $grammarForms['os'][$case][$word] ) ) {
return $grammarForms['os'][$case][$word];
- 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 doModify
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function doModify( CommentStoreComment $summary ): PageUpdateStatus {
$wikiPage = $this->getWikiPage(); // TODO: use for legacy hooks only!
// Update article, but only if changed.
$status = PageUpdateStatus::newEmpty( false );
- 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 stripComments
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static function stripComments( $json ) {
// Ensure we have a string
$str = (string)$json;
$buffer = '';
$maxLen = strlen( $str );
- 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 normalizeRequests
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function normalizeRequests( array &$reqs ) {
foreach ( $reqs as &$req ) {
$req['response'] = [
'code' => 0,
'reason' => '',
- 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 runMultiCurl
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function runMultiCurl( array $reqs, array $opts ) {
$chm = $this->getCurlMulti( $opts );
$selectTimeout = $this->getSelectTimeout( $opts );
- 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 toSql
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function toSql( DbQuoter $dbQuoter ): string {
if ( is_array( $this->value ) ) {
if ( count( $this->value ) === 1 ) {
$value = $this->value[0];
if ( $this->op === '=' ) {
- 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 extractResultInfo
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
protected function extractResultInfo( $isFirst, $limit, IResultWrapper $res ) {
$numRows = $res->numRows();
$firstIndex = [];
$lastIndex = [];
- 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 getSiteNotice
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function getSiteNotice() {
$siteNotice = '';
if ( $this->getHookRunner()->onSiteNoticeBefore( $siteNotice, $this ) ) {
if ( $this->getUser()->isRegistered() ) {
- 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 areFiltersInConflict
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
protected function areFiltersInConflict() {
$opts = $this->getOptions();
foreach ( $this->getFilterGroups() as $group ) {
if ( $group->getConflictingGroups() ) {
wfLogWarning(
- 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"