Showing 9,462 of 11,498 total issues
Function insertComment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function insertComment( $rc ) {
if ( static::isDeleted( $rc, RevisionRecord::DELETED_COMMENT ) ) {
$deletedClass = 'history-deleted';
if ( static::isDeleted( $rc, RevisionRecord::DELETED_RESTRICTED ) ) {
$deletedClass .= ' mw-history-suppressed';
- 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 purgeExpiredRows
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function purgeExpiredRows() {
$services = MediaWikiServices::getInstance();
$rcMaxAge = $services->getMainConfig()->get(
MainConfigNames::RCMaxAge );
$updateRowsPerQuery = $services->getMainConfig()->get(
- 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 getPreferenceForField
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function getPreferenceForField( $name, HTMLFormField $field, array $userOptions ) {
$val = $userOptions[$name] ?? null;
if ( $field instanceof HTMLNestedFilterable ) {
$val = [];
- 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( string $code, $mode = null ) {
// Don't do double loading...
if ( $this->isLanguageLoaded( $code ) && $mode !== self::FOR_UPDATE ) {
return true;
}
- 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 getAvailableLanguages
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getAvailableLanguages( File $file ) {
$langList = [];
$metadata = $this->validateMetadata( $file->getMetadataArray() );
if ( isset( $metadata['translations'] ) ) {
foreach ( $metadata['translations'] as $lang => $langType ) {
- 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 internalUserTimeAndDate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function internalUserTimeAndDate( $type, $ts, UserIdentity $user, array $options ) {
$ts = wfTimestamp( TS_MW, $ts );
$options += [ 'timecorrection' => true, 'format' => true ];
if ( $options['timecorrection'] !== false ) {
if ( $options['timecorrection'] === true ) {
- 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 convIPTCHelper
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static function convIPTCHelper( $data, $charset ) {
if ( $charset ) {
AtEase::suppressWarnings();
$data = iconv( $charset, "UTF-8//IGNORE", $data );
AtEase::restoreWarnings();
- 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 getLongDesc
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getLongDesc( $image ) {
global $wgLang;
$original = parent::getLongDesc( $image );
$metadata = $image->getMetadataArray();
- 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 resolveMultivalueValue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function resolveMultivalueValue( $value ) {
if ( !is_array( $value ) ) {
return $value;
}
if ( isset( $value['_type'] ) && $value['_type'] === 'lang' ) {
- 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 wfMsgReplaceArgs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function wfMsgReplaceArgs( $message, $args ) {
# Fix windows line-endings
# Some messages are split with explode("\n", $msg)
$message = str_replace( "\r", '', $message );
- 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 getLimitOffsetForUser
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getLimitOffsetForUser( UserIdentity $user, $deflimit = 50, $optionname = 'rclimit' ) {
$limit = $this->getInt( 'limit', 0 );
if ( $limit < 0 ) {
$limit = 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 getSizeAndMetadata
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getSizeAndMetadata( $state, $filename ) {
$header = self::getXCFMetaData( $filename );
$metadata = [];
if ( $header ) {
// Try to be consistent with the names used by PNG files.
- 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 debug
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function debug( $in, $fname, $action = null ) {
if ( !$this->log ) {
return;
}
$type = gettype( $in );
- 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 readPHPFile
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function readPHPFile( $fileName, $fileType ) {
$serialize = $fileType === 'core';
if ( !isset( $this->fileCache[$fileName][$fileType] ) ) {
$data = parent::readPHPFile( $fileName, $fileType );
- 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 normaliseParamsInternal
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function normaliseParamsInternal( $image, $params ) {
$svgMaxSize = MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::SVGMaxSize );
# Don't make an image bigger than wgMaxSVGSize on the smaller side
if ( $params['physicalWidth'] <= $params['physicalHeight'] ) {
- 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 parseFormDjvu
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function parseFormDjvu( $line ) {
$parentLevel = strspn( $line, ' ' );
$line = strtok( "\n" );
# Find INFO
while ( $line !== 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 swapICCProfile
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function swapICCProfile( $filepath, array $colorSpaces,
array $oldProfileStrings, $profileFilepath
) {
$exiftool = MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::Exiftool );
- 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 fetchExtendedMetadata
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function fetchExtendedMetadata( File $file ) {
$cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
// If revision deleted, exit immediately
if ( $file->isDeleted( File::DELETED_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 getCORSSources
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getCORSSources() {
$additionalUrls = [];
$CORSSources = $this->mwConfig->get( MainConfigNames::CrossSiteAJAXdomains );
foreach ( $CORSSources as $source ) {
if ( strpos( $source, '?' ) !== 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 wfDebugBacktrace
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function wfDebugBacktrace( $limit = 0 ) {
static $disabled = null;
if ( $disabled === null ) {
$disabled = !function_exists( 'debug_backtrace' );
- 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"