Showing 1,432 of 2,096 total issues
Function getClientUserId
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getClientUserId( $repoUserId, array $metadata, bool $changeComesFromLocalDb ) {
if ( $repoUserId === 0 ) {
// Logged out on repo just copied to client
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 injectRCRecords
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function injectRCRecords( array $titles, EntityChange $change, array $rootJobParams = [] ) {
if ( $titles === [] ) {
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 getLink
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getLink( Title $title, $action, $hasLangLinks, ?array $noExternalLangLinks, $prefixedId ) {
if ( $this->canHaveLink( $title, $action, $noExternalLangLinks ) ) {
$entityId = null;
if ( is_string( $prefixedId ) ) {
- 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 renumber
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function renumber( array &$entityArr ) {
foreach ( $entityArr as &$value ) {
if ( !is_array( $value ) ) {
continue;
}
- 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 onPageMoveComplete
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function onPageMoveComplete(
$oldLinkTarget,
$newLinkTarget,
$userIdentity,
$pageId,
- 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 isPrefetched
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function isPrefetched( EntityId $entityId, array $termTypes, array $languageCodes ): bool {
foreach ( $termTypes as $termType ) {
foreach ( $languageCodes as $languageCode ) {
$key = $this->getKey( $entityId, $termType, $languageCode );
if ( !isset( $this->termKeys[$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 indexLinksByInterwiki
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function indexLinksByInterwiki( array $links ) {
$indexed = [];
foreach ( $links as $link ) {
$siteId = $link->getSiteId();
- 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 rebuild
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function rebuild() {
$ticket = $this->db->getEmptyTransactionTicket( __METHOD__ );
foreach ( $this->getIdBatches() as $itemIds ) {
$this->progressReporter->reportMessage(
- 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 getOrCreatePingbackId
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getOrCreatePingbackId() {
if ( !$this->id ) {
$dbr = $this->repoConnections->getReadConnection();
$id = $dbr->newSelectQueryBuilder()
- 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 extractSummaryProperties
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function extractSummaryProperties( $result ): array {
$propertyIds = [];
foreach ( $result as $revisionRow ) {
$comment = $this->getCommentText( $revisionRow );
if ( $comment === 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 onOutputPageParserOutput
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function onOutputPageParserOutput( $outputPage, $parserOutput ): void {
$title = $outputPage->getTitle();
if ( !$title || !$this->namespaceChecker->isWikibaseEnabled( $title->getNamespace() ) ) {
// shorten out
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 generateOpHtml
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function generateOpHtml( array $path, DiffOp $op ): string {
if ( $op instanceof AtomicDiffOp ) {
$localizedPath = $path;
$translatedLinkSubPath = $this->messageLocalizer->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 onLoadExtensionSchemaUpdates
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function onLoadExtensionSchemaUpdates( $updater ) {
$db = $updater->getDB();
$type = $db->getType();
if ( $type !== 'mysql' && $type !== 'sqlite' && $type !== 'postgres' ) {
- 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 buildPreliminarySidebarFromSiteLinks
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function buildPreliminarySidebarFromSiteLinks( array $siteLinks ) {
$linksByGroup = [];
foreach ( $siteLinks as $siteLink ) {
if ( !in_array( $siteLink->getSiteId(), $this->siteIdsToOutput ) ) {
- 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 addJsModules
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function addJsModules( OutputPage $outputPage, Title $title, $actionName, Skin $skin ): void {
$user = $outputPage->getUser();
if ( $this->hasLinkItemWidget( $user, $outputPage, $title, $actionName ) ) {
// Add the JavaScript which lazy-loads the link item widget
- 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 onSidebarBeforeOutput
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function onSidebarBeforeOutput( $skin, &$sidebar ): void {
// Add the 'In other projects' section
$otherProjectsSidebar = $this->buildOtherProjectsSidebar( $skin );
$sidebar['wikibase-otherprojects'] = $otherProjectsSidebar === null ? [] : $otherProjectsSidebar;
- 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 getBadgeInfo
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function getBadgeInfo( array $badgeIds ) {
$classes = [];
$labels = [];
foreach ( $badgeIds as $badgeId ) {
- 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 compareAndReturnNewUsagesAccountingForDeduplication
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function compareAndReturnNewUsagesAccountingForDeduplication(
array $newUsages,
array $oldUsages
): array {
$result = [];
- 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 getClientWikis
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function getClientWikis( SettingsArray $repoSettings ): array {
$clientWikis = $repoSettings->getSetting( 'localClientDatabases' );
// make sure we have a mapping from siteId to database name in clientWikis:
foreach ( $clientWikis as $siteID => $dbName ) {
if ( is_int( $siteID ) ) {
- 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 setKeys
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function setKeys( array $entityIds, array $termTypes, array $languageCodes ): void {
foreach ( $entityIds as $entityId ) {
foreach ( $termTypes as $termType ) {
foreach ( $languageCodes as $languageCode ) {
$key = $this->getKey( $entityId, $termType, $languageCode );
- 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"