Showing 1,432 of 2,096 total issues
Method updateQuantityUnit
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function updateQuantityUnit( EntityDocument $entity ) {
$updateCounter = 0;
if ( !$entity instanceof StatementListProvider ) {
$this->errorReporter->reportMessage(
Method validateAndDeserialize
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validateAndDeserialize( PropertyLabelEditRequest $request ): Term {
$property = $this->propertyRetriever->getPropertyWriteModel( new NumericPropertyId( $request->getPropertyId() ) );
$label = $request->getLabel();
$language = $request->getLanguageCode();
Method getLinks
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getLinks(
?array $numericIds = null,
?array $siteIds = null,
?array $pageNames = null
): array {
Method formatReference
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function formatReference( Reference $reference ): string {
$referenceSnaks = new ByCertainPropertyIdGrouper( $reference->getSnaks(), [
$this->properties->referenceUrlPropertyId,
$this->properties->titlePropertyId,
$this->properties->statedInPropertyId,
Function run
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function run(): bool {
$change = $this->getChange();
$titles = $this->getTitles();
if ( !$change || $titles === [] ) {
- 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 getMediaWikiPermissionsToCheck
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function getMediaWikiPermissionsToCheck( $action, $entityType ) {
if ( $action === self::ACTION_MW_CREATE ) {
$entityTypeSpecificCreatePermission = $entityType . '-create';
$permissions = [ 'read', 'edit', 'createpage' ];
- 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 generateDump
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function generateDump( EntityIdPager $idPager ): void {
$dumpCount = 0;
$this->preDump();
- 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 getTermsSerializationWithFallbackInfo
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function getTermsSerializationWithFallbackInfo(
array $serialization,
array $termFallbackChains
) {
$newSerialization = $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
Method __construct
has 14 arguments (exceeds 4 allowed). Consider refactoring. Open
ApiMain $mainModule,
string $moduleName,
StringNormalizer $stringNormalizer,
LanguageFallbackChainFactory $languageFallbackChainFactory,
SiteLinkGlobalIdentifiersProvider $siteLinkGlobalIdentifiersProvider,
Function collectNewAndOldTerms
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function collectNewAndOldTerms( ChangeOpFingerprintResult $changeOpsResult ): array {
$traversable = $this->makeRecursiveTraversable( $changeOpsResult );
$newTerms = [];
$oldTerms = [];
- 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
Method __construct
has 14 arguments (exceeds 4 allowed). Consider refactoring. Open
EntityDataUriManager $uriManager,
HTMLCacheUpdater $htmlCacheUpdater,
EntityIdParser $entityIdParser,
EntityRevisionLookup $entityRevisionLookup,
EntityRedirectLookup $entityRedirectLookup,
Function next
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function next() {
$id = null;
while ( $id === null ) {
$this->reader->next();
- 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 cleanupGregorianValue
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function cleanupGregorianValue( $dateValue, $precision ) {
try {
[ $minus, $y, $m, $d, $time ] = $this->parseDateValue( $dateValue );
} catch ( IllegalValueException $e ) {
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
Method factory
has 14 arguments (exceeds 4 allowed). Consider refactoring. Open
Language $contentLanguage,
HttpRequestFactory $httpRequestFactory,
IBufferingStatsdDataFactory $statsdDataFactory,
UserOptionsLookup $userOptionsLookup,
EntityContentFactory $entityContentFactory,
Function addSiteLinks
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function addSiteLinks( Item $item ) {
$id = $item->getId();
$entityLName = $this->vocabulary->getEntityLName( $id );
$entityRepoName = $this->vocabulary->getEntityRepositoryName( $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 equals
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function equals( Content $that = null ) {
if ( $that === $this ) {
return 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 execute
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
if ( !WikibaseSettings::isRepoEnabled() ) {
$this->fatalError( "You need to have Wikibase enabled in order to use this maintenance script!" );
}
$format = $this->getOption( 'format', 'json' );
- 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 getTermMatchQueries
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function getTermMatchQueries(
IReadableDatabase $dbr,
TermIndexSearchCriteria $mask,
string $entityType,
$termType = 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 assertConfigArrayWellFormed
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private function assertConfigArrayWellFormed( array $sourceConfig ) {
Assert::parameterElementType( 'array', $sourceConfig, '$sourceConfig' );
foreach ( $sourceConfig as $sourceName => $sourceData ) {
if ( !is_string( $sourceName ) ) {
- 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
Method __construct
has 14 arguments (exceeds 4 allowed). Consider refactoring. Open
EntityIdParser $entityIdParser,
EntityIdComposer $entityIdComposer,
Deserializer $dataValueDeserializer,
NameTableStore $slotRoleStore,
DataAccessSettings $dataAccessSettings,