Showing 1,432 of 2,096 total issues
Function getEligibleRevisionIdentifiersById
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getEligibleRevisionIdentifiersById( EntityId $entityId, array $ids ): array {
$revisions = [];
foreach ( $ids as $id ) {
$timestamp = $this->revisionLookup->getTimestampFromId( $id );
- 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 fetchIds
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function fetchIds( $limit ) {
Assert::parameter( is_int( $limit ) && $limit > 0, '$limit', '$limit must be a positive integer' );
$dbr = $this->db->connections()->getReadConnection();
$queryBuilder = $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 addLinksToOutput
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function addLinksToOutput( array $links, ParserOutput $parserOutput ) {
foreach ( $links as $siteId => $siteLink ) {
$page = $siteLink->getPageName();
$targetSite = $this->siteLookup->getSite( $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 filterRepoLinksByGroup
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function filterRepoLinksByGroup( array $repoLinks, array $allowedGroups ) {
foreach ( $repoLinks as $wiki => $link ) {
if ( !$this->siteLookup->getSite( $wiki ) ) {
unset( $repoLinks[$wiki] );
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 getConflictForSiteLink
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getConflictForSiteLink( string $itemId, SiteLink $siteLink ): ?array {
$key = $this->cacheKey( $siteLink );
$ttl = BagOStuff::TTL_MINUTE;
$conflict = [
'siteId' => $siteLink->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 overridePageMetaTags
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function overridePageMetaTags( OutputPage $outputPage ) {
$meta = $this->getOutput()->getProperty( 'wikibase-meta-tags' );
if ( $this->isDiff() ) {
if ( isset( $meta['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 getUsedEntityIdStrings
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getUsedEntityIdStrings( array $idStrings ): array {
// Note: We need to use one (sub)query per entity here, per T116404
$subQueries = $this->getUsedEntityIdStringsQueries( $idStrings );
$readConnection = $this->db->connections()->getReadConnection();
- 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 collectValuesInternal
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static function collectValuesInternal( array $data, array $flippedIgnoreArray, array &$values = [] ) {
foreach ( $data as $key => $value ) {
if ( isset( $flippedIgnoreArray[$key] ) ) {
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 localLinksToArray
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function localLinksToArray( array $flatLinks ) {
$links = [];
$sites = $this->siteLookup->getSites();
foreach ( $flatLinks as $s ) {
- 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 getConflictsForItem
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getConflictsForItem( ItemId $itemId, SiteLinkList $siteLinkList, int $db = null ) {
if ( $siteLinkList->isEmpty() ) {
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 addLinkHeaders
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function addLinkHeaders( OutputPage $outputPage ) {
if ( !$this->isEditable() ) {
return;
}
$variables = $outputPage->getJsConfigVars();
- 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 checkCanCreateRedirect
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function checkCanCreateRedirect( EntityId $entityId ): void {
try {
$revision = $this->entityRevisionLookup->getEntityRevision(
$entityId,
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 getEntityIdMatchingSearchTerm
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getEntityIdMatchingSearchTerm( $term, $entityType ) {
$entityId = null;
foreach ( $this->getEntityIdCandidatesForSearchTerm( $term ) as $candidate ) {
try {
$entityId = $this->idParser->parse( $candidate );
- 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 validateParameters
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function validateParameters( array $params ): void {
if ( $params['snaktype'] === 'value' xor isset( $params['value'] ) ) {
if ( $params['snaktype'] === 'value' ) {
$this->errorReporter->dieWithError(
[ 'wikibase-api-claim-value-missing' ],
- 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 filterEntitySerializationUsingSiteIds
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function filterEntitySerializationUsingSiteIds(
array $serialization,
array $siteIds = null
) {
if ( $siteIds && array_key_exists( 'sitelinks', $serialization ) ) {
- 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 addRevisionIdFromStatusToResult
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function addRevisionIdFromStatusToResult( Status $status, $path, $oldRevId = null ) {
$value = $status->getValue();
if ( isset( $value['revision'] ) ) {
if ( $value['revision'] instanceof EntityRevision ) {
- 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 addTermsToResult
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function addTermsToResult( array $pagesToEntityIds, array $termGroups ): void {
$result = $this->getResult();
foreach ( $pagesToEntityIds as $currentPage => $entityId ) {
if ( !isset( $termGroups[$currentPage] ) ) {
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
public function validate( $value ) {
$result = Result::newSuccess();
foreach ( $this->validators as $validator ) {
$subResult = $validator->validate( $value );
- 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 executeInternal
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function executeInternal(): void {
$params = $this->extractRequestParams();
$statement = $this->getStatementFromParams( $params );
$guid = $statement->getGuid();
- 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 applyChangeOp
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function applyChangeOp( ChangeOp $changeOp, EntityDocument $entity, Summary $summary = null ): ChangeOpResult {
try {
// NOTE: Always validate modification against the current revision, if it exists!
// Otherwise, we may miss e.g. a combination of language/label/description
// that was already taken.
- 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"