Showing 11,545 of 11,545 total issues
Function login
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function login( $username, $password, WebRequest $request ) {
$enableBotPasswords = MediaWikiServices::getInstance()->getMainConfig()
->get( MainConfigNames::EnableBotPasswords );
$passwordAttemptThrottle = MediaWikiServices::getInstance()->getMainConfig()
->get( MainConfigNames::PasswordAttemptThrottle );
- 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 getBaseRegex
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getBaseRegex( bool $capture = true, string $delimiter = '/' ): array {
if ( $capture && $delimiter === '/' && $this->baseRegex !== null ) {
return $this->baseRegex;
}
$regex = [ 0 => [], 1 => [] ];
- 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 applyPrefix
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function applyPrefix( $name ) {
$services = MediaWikiServices::getInstance();
$userNameUtils = $services->getUserNameUtils();
if ( $userNameUtils->getCanonical( $name, UserRigorOptions::RIGOR_USABLE ) === false ) {
return $name;
- 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 store
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function store( UserIdentity $user, array $updates ) {
// In core, only users with local accounts may have preferences
if ( !$user->getId() ) {
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 __construct
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( $config ) {
$this->enabled = $config['enabled'] ?? false;
$this->known = $this->enabled || ( $config['known'] ?? false );
// Configuration related to creating new temporary accounts for some actions
- 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 getFile
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getFile( $key, $noAuth = false ) {
if ( !preg_match( self::KEY_FORMAT_REGEX, $key ) ) {
throw new UploadStashBadPathException(
wfMessage( 'uploadstash-bad-path-bad-format', $key )
);
- 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 findFiles
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function findFiles( array $items, $flags = 0 ) {
$result = [];
foreach ( $items as $item ) {
if ( is_array( $item ) ) {
$title = $item['title'];
- 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 buildModuleMap
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function buildModuleMap(): array {
$modules = [];
$noPrefixFiles = [];
$id = ''; // should not be used, make Phan happy
- 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 getSearchResultsOrThrow
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function getSearchResultsOrThrow( $results ) {
if ( $results ) {
if ( $results instanceof StatusValue ) {
$status = $results;
if ( !$status->isOK() ) {
- 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 getDbResults
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function getDbResults( ExistingPageRecord $page, array $params, $relativeRevId, $ts, $tagIds ) {
$dbr = $this->dbProvider->getReplicaDatabase();
$queryBuilder = $this->revisionStore->newSelectQueryBuilder( $dbr )
->joinComment()
->where( [ 'rev_page' => $page->getId() ] )
- 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 updateCategoryCounts
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function updateCategoryCounts( array $insertedLinks, array $deletedLinks ) {
if ( !$insertedLinks && !$deletedLinks ) {
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 write
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function write( array $record ): void {
if ( $this->useLegacyFilter &&
!LegacyLogger::shouldEmit(
$record['channel'], $record['message'],
$record['level'], $record
- 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 deprecatedMsg
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function deprecatedMsg( $msg, $version = false,
$component = false, $callerOffset = 2
) {
if ( $callerOffset === false ) {
$callerFunc = '';
- 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 getWikiText
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getWikiText( StatusValue $status, array $options = [] ) {
$shortContext = $options['shortContext'] ?? null;
$longContext = $options['longContext'] ?? null;
$lang = $options['lang'] ?? 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 __construct
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( array $config = [] ) {
$config = array_merge( [
// Default config values
'precision' => 'day',
'longDisplayFormat' => 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 process
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function process( $pattern, $extracts, &$linesleft, &$contextchars, &$out, &$offsets ) {
if ( $linesleft == 0 ) {
return; // nothing to do
}
foreach ( $extracts as $index => $line ) {
- 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 getTextSpawnedOnce
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function getTextSpawnedOnce( $address ) {
if ( is_int( $address ) || intval( $address ) ) {
$address = SqlBlobStore::makeAddressFromTextId( (int)$address );
}
- 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 notifyRCFeeds
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function notifyRCFeeds( array $feeds = null ) {
$feeds ??=
MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::RCFeeds );
$performer = $this->getPerformerIdentity();
- 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 updateBatch
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function updateBatch( IResultWrapper $res ) {
if ( !$this->dryRun ) {
$this->beginTransaction( $this->dbw, __METHOD__ );
}
foreach ( $res as $row ) {
- 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 14 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$this->initServices();
$fromPattern = new Pattern( 'from', $this->getOption( 'from' ) );
$toPattern = new Pattern( 'to', $this->getOption( 'to' ) );
- 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"