Showing 1,432 of 2,096 total issues
Function processSnak
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function processSnak( Snak $snak ) {
if ( $snak instanceof PropertyValueSnak ) {
$id = $snak->getPropertyId();
$value = $snak->getDataValue();
- 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 getStatementIdPath
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getStatementIdPath( array $serialization, string $id ): string {
foreach ( $serialization as $propertyId => $statementGroup ) {
foreach ( $statementGroup as $groupIndex => $statement ) {
if ( isset( $statement['id'] ) && $statement['id'] === $id ) {
return "/statements/$propertyId/$groupIndex";
- 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 deserialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function deserialize( array $serialization, string $basePath = '' ): Statement {
if ( count( $serialization ) && array_is_list( $serialization ) ) {
throw new InvalidFieldTypeException( $serialization, $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 getStatementIdPath
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getStatementIdPath( array $serialization, string $id ): string {
foreach ( $serialization as $propertyId => $statementGroup ) {
foreach ( $statementGroup as $groupIndex => $statement ) {
if ( isset( $statement['id'] ) && $statement['id'] === $id ) {
return "/statements/$propertyId/$groupIndex";
- 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 getMultipleTermsByLanguageFromLookup
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getMultipleTermsByLanguageFromLookup( EntityId $entityId, string $termType, array $languages ) {
if ( $termType === TermTypes::TYPE_LABEL ) {
$freshTerms = $this->lookup->getLabels( $entityId, $languages );
} else {
$freshTerms = $this->lookup->getDescriptions( $entityId, $languages );
- 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 storeTerms
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function storeTerms( NumericPropertyId $propertyId, Fingerprint $terms ) {
$firstException = null;
foreach ( $this->propertyTermStoreWriters as $propertyTermStoreWriter ) {
try {
$propertyTermStoreWriter->storeTerms( $propertyId, $terms );
- 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 splitIsoTimestamp
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function splitIsoTimestamp( $isoTimestamp, $precision ) {
if ( !preg_match(
'/(\d+)\D+(\d+)\D+(\d+)\D+(\d+)\D+(\d+)\D+(\d+)/',
$isoTimestamp,
$matches
- 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 getLatestRevisionId
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getLatestRevisionId( EntityId $entityId, $mode = LookupConstants::LATEST_FROM_REPLICA ) {
$rows = $this->entityMetaDataAccessor->loadRevisionInformation( [ $entityId ], $mode );
$row = $rows[$entityId->getSerialization()];
if ( $row && $row->page_latest ) {
- 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 extractPreferredValue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function extractPreferredValue( array $data ): ?array {
if ( !$data ) {
return 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 buildStore
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function buildStore( array $sites, $siteGroup = null, $wikiId = null ) {
if ( $siteGroup === null && is_string( $wikiId ) ) {
$siteGroup = $this->getInterwikiGroup( $sites, $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 deleteTerms
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function deleteTerms( NumericPropertyId $propertyId ) {
$firstException = null;
foreach ( $this->propertyTermStoreWriters as $propertyTermStoreWriter ) {
try {
$propertyTermStoreWriter->deleteTerms( $propertyId );
- 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 cleanTextInLangIds
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function cleanTextInLangIds( array $textInLangIds ): void {
if ( $textInLangIds === [] ) {
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 assertFormatterArray
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function assertFormatterArray( $format, array $formatters ) {
foreach ( $formatters as $type => $formatter ) {
if ( !is_string( $type ) ) {
throw new InvalidArgumentException( 'formatter array must map type IDs to formatters.' );
}
- 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 setEntityTypeData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function setEntityTypeData( array $entityNamespaceIdsAndSlots ) {
foreach ( $entityNamespaceIdsAndSlots as $entityType => $namespaceIdAndSlot ) {
if ( !is_string( $entityType ) ) {
throw new \InvalidArgumentException( 'Entity type name not a string: ' . $entityType );
}
- 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 addObjectToPropertyGroup
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function addObjectToPropertyGroup( $object, $index = null ) {
$propertyId = $object->getPropertyId();
$validIndices = $this->getFlatArrayIndices( $propertyId );
if ( empty( $validIndices ) ) {
- 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 getChangedStatements
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function getChangedStatements( Diff $claimsDiff ) {
$changedStatements = [];
foreach ( $claimsDiff as $pid => $diffOp ) {
/** @var Statement $statement */
- 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 patchStatementList
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function patchStatementList( StatementList $statements, Diff $patch ) {
/**
* @var Statement $statement
* @var Statement $oldStatement
* @var Statement $newStatement
- 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
Avoid too many return
statements within this function. Open
return -1;
Avoid too many return
statements within this function. Open
return new datamodel.Statement(
new datamodel.Claim( mainSnak, qualifiers, guid ),
references,
this._rankSelector.value()
);
Avoid too many return
statements within this function. Open
return 0;