Showing 11,779 of 11,779 total issues
Function reformat
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function reformat( $preference, $text, $options = [] ) {
$userFormatId = self::PREFERENCE_IDS[$preference] ?? self::NONE;
foreach ( self::TARGET_FORMATS as $source => $_ ) {
if ( isset( self::RULES[$userFormatId][$source] ) ) {
# Specific rules
- 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 optionToString
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function optionToString( $value ) {
if ( $value === true ) {
return '1';
} elseif ( $value === false ) {
return '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 getDefaultOptions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getDefaultOptions( ?UserIdentity $userIdentity = null ): array {
$defaultOptions = $this->getGenericDefaultOptions();
// If requested, process any conditional defaults
if ( $userIdentity ) {
- 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 loginHook
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private static function loginHook( $user, $bp, User $performer, Status $status ) {
$extraData = [
'performer' => $performer
];
if ( $user instanceof User ) {
- 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 isValid
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function isValid( string $name ): bool {
if ( $name === ''
|| $this->isIP( $name )
|| $this->isValidIPRange( $name )
|| $this->isLikeIPv4DashRange( $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 getId
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getId( $wikiId = self::LOCAL ): int {
$this->assertWiki( $wikiId );
if ( $this->mId === null && $this->mName !== null ) {
$userNameUtils = MediaWikiServices::getInstance()->getUserNameUtils();
if ( $userNameUtils->isIP( $this->mName ) || ExternalUserNames::isExternal( $this->mName ) ) {
- 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 getActionText
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getActionText() {
if ( $this->canView( LogPage::DELETED_ACTION ) ) {
$element = $this->getActionMessage();
if ( $element instanceof Message ) {
$element = $this->plaintext ? $element->text() : $element->escaped();
- 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 getUserGroupMemberships
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getUserGroupMemberships(
UserIdentity $user,
int $queryFlags = IDBAccessObject::READ_NORMAL
): array {
$user->assertWiki( $this->wikiId );
- 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 getExperienceLevel
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getExperienceLevel() {
$mainConfig = MediaWikiServices::getInstance()->getMainConfig();
$learnerEdits = $mainConfig->get( MainConfigNames::LearnerEdits );
$experiencedUserEdits = $mainConfig->get( MainConfigNames::ExperiencedUserEdits );
$learnerMemberSince = $mainConfig->get( MainConfigNames::LearnerMemberSince );
- 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 getMessageKey
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function getMessageKey() {
$type = $this->entry->getType();
$subtype = $this->entry->getSubtype();
$sitewide = $this->entry->getParameters()['sitewide'] ?? 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 getToken
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getToken( $forceCreation = true ) {
$authenticationTokenVersion = MediaWikiServices::getInstance()
->getMainConfig()->get( MainConfigNames::AuthenticationTokenVersion );
$this->load();
- 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 getTypeMenuDesc
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getTypeMenuDesc() {
$typesByName = [];
// Load the log names
foreach ( LogPage::validTypes() as $type ) {
$page = new LogPage( $type );
- 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 clearForPageView
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function clearForPageView(
UserIdentity $user,
RevisionRecord $oldRev = null
) {
// Abort if the hook says so. (Echo doesn't abort, it just queues its own update)
- 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 makePageLink
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function makePageLink( Title $title = null, $parameters = [], $html = null ) {
if ( !$title instanceof Title ) {
$msg = $this->msg( 'invalidtitle' )->text();
if ( $this->plaintext ) {
return $msg;
- 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 getBlock
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getBlock(
$freshness = IDBAccessObject::READ_NORMAL,
$disableIpBlockExemptChecking = false
): ?Block {
if ( is_bool( $freshness ) ) {
- 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 getParameters
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getParameters() {
if ( !isset( $this->params ) ) {
$blob = $this->getRawParameters();
AtEase::suppressWarnings();
$params = LogEntryBase::extractParams( $blob );
- 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 makePageLink
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function makePageLink( Title $title = null, $parameters = [], $html = null ) {
$userrightsInterwikiDelimiter = $this->context->getConfig()
->get( MainConfigNames::UserrightsInterwikiDelimiter );
if ( !$this->plaintext ) {
- 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 getActionLinks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getActionLinks() {
$linkRenderer = $this->getLinkRenderer();
$subtype = $this->entry->getSubtype();
if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) // Action is hidden
|| $subtype === 'move_prot' // the move log entry has the right action link
- 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 getMessageKey
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function getMessageKey() {
$key = parent::getMessageKey();
if ( in_array( $this->entry->getSubtype(), [ 'event', 'revision' ] ) ) {
if ( count( $this->getMessageParameters() ) < 5 ) {
// Messages: logentry-delete-event-legacy, logentry-delete-revision-legacy,
- 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 handleRequest
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function handleRequest() {
$thumbPath = $this->getConfig( MainConfigNames::ThumbPath );
if ( $thumbPath ) {
$relPath = $this->getRequestPathSuffix( $thumbPath );
- 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"