Showing 1,432 of 2,096 total issues
Function rebuild
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function rebuild() {
$ticket = $this->db->getEmptyTransactionTicket( __METHOD__ );
while ( true ) {
$propertyIds = $this->idPager->fetchIds( $this->batchSize );
- 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 getEntityIdsToFetch
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function getEntityIdsToFetch( array $entityIds, array $termTypes, array $languageCodes ): array {
/** @var EntityId[] serialization -> EntityId */
$entityIdsToFetch = [];
foreach ( $entityIds as $entityId ) {
- 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 getTitleForNotification
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function getTitleForNotification( DiffOp $siteLinkDiffOp ) {
if ( $siteLinkDiffOp instanceof DiffOpAdd ) {
$new = $siteLinkDiffOp->getNewValue();
$newTitle = Title::newFromText( $new );
return $this->canNotifyForTitle( $newTitle ) ? $newTitle : 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 handleDisabledUsages
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function handleDisabledUsages( array $usages ): array {
$newUsages = [];
foreach ( $usages as $usage ) {
if ( !( $usage instanceof EntityUsage ) ) {
- 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 rebuildSiteLinks
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function rebuildSiteLinks( array $itemIds ): int {
$this->entityPrefetcher->prefetch( $itemIds );
$c = 0;
foreach ( $itemIds as $itemId ) {
- 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 adjustFlagsForMCR
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function adjustFlagsForMCR( $flags, $parentRevision, $slotRole ) {
if ( $flags & EDIT_UPDATE ) {
if ( !$parentRevision ) {
throw new StorageException( 'Can\'t perform an update with no parent revision' );
}
- 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 addEntityRevision
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function addEntityRevision(
$sourceEntityIdSerialization,
EntityRevision $entityRevision,
$props = 'all',
array $filterSiteIds = 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 getForm
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function getForm( EntityDocument $entity = null ) {
if ( $this->page === null ) {
$this->page = $this->site === null ? '' : $this->getSiteLink( $entity, $this->site );
}
if ( !$this->badges ) {
- 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 saveRedirect
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function saveRedirect(
EntityRedirect $redirect,
FormatableSummary $summary,
IContextSource $context,
bool $bot,
- 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 createEntity
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function createEntity( $entityType, EntityId $customId = null, $assignFreshId = self::ASSIGN_FRESH_ID ): EntityDocument {
if ( $customId ) {
$entityType = $customId->getEntityType();
} elseif ( !$entityType ) {
$this->errorReporter->dieError(
- 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 modifyEntity
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function modifyEntity( EntityDocument $entity, ChangeOp $changeOp, array $preparedParameters ): Summary {
if ( !( $entity instanceof Item ) ) {
$this->errorReporter->dieError( "The given entity is not an item", "not-item" );
}
- 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 resolveMentionedEntities
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function resolveMentionedEntities(): void {
$hasRedirect = false;
$this->markStubEntityDataForPrefetching( $this->entitiesResolved );
- 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 onShowSearchHit
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function onShowSearchHit( $searchPage, $result,
$terms, &$link, &$redirect, &$section, &$extract, &$score, &$size, &$date, &$related,
&$html
): void {
if ( $result instanceof ExtendedResult ) {
- 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 addEntityPageProps
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function addEntityPageProps( EntityDocument $entity ): void {
if ( !$this->shouldProduce( RdfProducer::PRODUCE_PAGE_PROPS ) ) {
return;
}
$pagePropertyDefs = $this->getPagePropertyDefs();
- 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 validate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function validate( EntityDocument $entity ) {
$languageValidator = $this->termValidatorFactory->getAliasLanguageValidator();
$termValidator = $this->termValidatorFactory->getAliasValidator();
// check that the language is valid
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$newJsonName = $this->getOption( 'config' );
$newJson = json_decode( file_get_contents( $newJsonName ), true );
if ( !$newJson ) {
$this->fatalError( "Cannot load new config" );
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
public function rebuild() {
$ticket = $this->db->getEmptyTransactionTicket( __METHOD__ );
$counter = 0;
while ( 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 getIdentifiersCount
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getIdentifiersCount( StatementList $statementList ): int {
$identifiers = 0;
foreach ( $statementList as $statement ) {
$propertyId = $statement->getPropertyId();
$propertyIdSerialization = $propertyId->getSerialization();
- 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 validate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function validate(
?string $itemId,
string $siteId,
array $sitelink,
string $basePath = ''
- 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 getTitlesForIds
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function getTitlesForIds( array $ids ): array {
Assert::parameterElementType( EntityId::class, $ids, '$ids' );
$titles = [];
$idsByType = [];
// get whatever federated ids or cached ids we can, and batch the rest of the ids by 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"