Showing 11,498 of 11,498 total issues
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"
Further reading
Function registerFiltersFromDefinitions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function registerFiltersFromDefinitions( array $definition ) {
$autoFillPriority = -1;
foreach ( $definition as $groupDefinition ) {
if ( !isset( $groupDefinition['priority'] ) ) {
$groupDefinition['priority'] = $autoFillPriority;
- 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 wfMergeErrorArrays
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function wfMergeErrorArrays( ...$args ) {
$out = [];
foreach ( $args as $errors ) {
foreach ( $errors as $params ) {
$originalParams = $params;
- 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 addTabIndex
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function addTabIndex( &$formDescriptor ) {
$i = 1;
foreach ( $formDescriptor as &$definition ) {
$class = false;
if ( array_key_exists( 'class', $definition ) ) {
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( Installer $installer ) {
$this->installer = $installer;
$this->extensions = $installer->getVar( '_Extensions' );
$this->skins = $installer->getVar( '_Skins' );
- 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"