Showing 1,432 of 2,096 total issues
Function getTermsOfEntities
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function getTermsOfEntities( array $entityIds, array $termTypes, string $languageCode ): array {
$this->termBuffer->prefetchTerms( $entityIds, $termTypes, [ $languageCode ] );
$terms = [];
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 getTermsOfEntities
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function getTermsOfEntities( array $entityIds, array $termTypes, string $languageCode ): array {
$this->termBuffer->prefetchTerms( $entityIds, $termTypes, [ $languageCode ] );
$terms = [];
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 createOrUpdate
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function createOrUpdate(
EntityDocument $entity,
EditMetadata $editMetadata,
int $newOrUpdateFlag
): 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 updateQuantityUnit
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
private function updateQuantityUnit( EntityDocument $entity ) {
$updateCounter = 0;
if ( !$entity instanceof StatementListProvider ) {
$this->errorReporter->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 saveEntity
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public saveEntity(
entity: Entity,
base?: EntityRevision,
assertUser = true,
): Promise<EntityRevisionWithRedirect> {
File SpecialNewProperty.php
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Wikibase\Repo\Specials;
use MediaWiki\Output\OutputPage;
Function _createListView
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
_createListView: function () {
var self = this,
listItemAdapter = this.options.getListItemAdapter(
function () {
return self._getUnusedAllowedSiteIds().map( function ( siteId ) {
Method switchForm
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function switchForm( $siteId, $page ) {
$siteExists = $siteId
&& $this->siteLinkTargetProvider->getSiteList( $this->groups )->hasSite( $siteId );
$this->logger->debug(
Method assertValidSitelinks
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function assertValidSitelinks( string $itemId, array $originalSitelinks, array $serialization ): void {
$validationError = $this->sitelinksValidator->validate(
$itemId,
$serialization,
$this->getModifiedSitelinksSites( $originalSitelinks, $serialization )
Method getEntityRevision
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getEntityRevision(
EntityId $entityId,
$revisionId = 0,
$mode = LookupConstants::LATEST_FROM_REPLICA
) {
Function initLinkItem
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initLinkItem( elem ) {
var $spinner = $.createSpinner(),
$linkItemLink = $( elem );
$linkItemLink
Function _create
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
_create: function () {
var self = this;
PARENT.prototype._create.call( this );
Function _createListView
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
_createListView: function () {
var self = this,
listItemWidget = $.wikibase.entitytermsforlanguageview,
prefix = listItemWidget.prototype.widgetEventPrefix;
Function _create
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
_create: function () {
if ( !( this.options.value instanceof datamodel.Fingerprint )
|| !Array.isArray( this.options.userLanguages )
) {
throw new Error( 'Required option(s) missing' );
Method run
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run(): bool {
$change = $this->getChange();
$titles = $this->getTitles();
if ( !$change || $titles === [] ) {
Method getStatus
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getStatus( WebRequest $req, RevisionRecord $latestRevision ): Status {
if ( $req->getCheck( 'restore' ) ) { // nearly the same as undoafter without undo
$olderRevision = $this->revisionLookup->getRevisionById( $req->getInt( 'restore' ) );
if ( !$olderRevision ) {
Method getFormFields
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function getFormFields() {
$formFields = [
self::FIELD_LANG => [
'name' => self::FIELD_LANG,
'class' => HTMLContentLanguageField::class,
Method __construct
has 16 arguments (exceeds 4 allowed). Consider refactoring. Open
array $tags,
SpecialPageCopyrightView $copyrightView,
EntityNamespaceLookup $entityNamespaceLookup,
SummaryFormatter $summaryFormatter,
EntityTitleLookup $entityTitleLookup,
Method __construct
has 16 arguments (exceeds 4 allowed). Consider refactoring. Open
EntityTitleStoreLookup $entityTitleStoreLookup,
ExceptionLocalizer $exceptionLocalizer,
PropertyDataTypeLookup $dataTypeLookup,
SiteLookup $siteLookup,
SummaryFormatter $summaryFormatter,
Method __construct
has 16 arguments (exceeds 4 allowed). Consider refactoring. Open
HttpRequestFactory $httpRequestFactory,
IBufferingStatsdDataFactory $statsdDataFactory,
SettingsArray $repoSettings,
TemplateFactory $templateFactory,
EntityRevisionLookup $entityRevisionLookup,