wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 2,096 of 2,096 total issues

Similar blocks of code found in 41 locations. Consider refactoring.
Open

<?php declare( strict_types = 1 );

namespace Wikibase\Repo\RestApi\Application\UseCases\GetPropertyLabelWithFallback;

use Wikibase\Repo\RestApi\Domain\ReadModel\Label;
repo/rest-api/src/Application/UseCases/AddItemStatement/AddItemStatementResponse.php on lines 1..33
repo/rest-api/src/Application/UseCases/AddPropertyStatement/AddPropertyStatementResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/CreateItem/CreateItemResponse.php on lines 1..38
repo/rest-api/src/Application/UseCases/CreateProperty/CreatePropertyResponse.php on lines 1..38
repo/rest-api/src/Application/UseCases/GetItem/GetItemResponse.php on lines 1..38
repo/rest-api/src/Application/UseCases/GetItemAliases/GetItemAliasesResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetItemAliasesInLanguage/GetItemAliasesInLanguageResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetItemDescription/GetItemDescriptionResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetItemDescriptionWithFallback/GetItemDescriptionWithFallbackResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetItemDescriptions/GetItemDescriptionsResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetItemLabel/GetItemLabelResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetItemLabelWithFallback/GetItemLabelWithFallbackResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetItemLabels/GetItemLabelsResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetItemStatements/GetItemStatementsResponse.php on lines 1..39
repo/rest-api/src/Application/UseCases/GetProperty/GetPropertyResponse.php on lines 1..38
repo/rest-api/src/Application/UseCases/GetPropertyAliases/GetPropertyAliasesResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetPropertyAliasesInLanguage/GetPropertyAliasesInLanguageResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetPropertyDescription/GetPropertyDescriptionResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetPropertyDescriptionWithFallback/GetPropertyDescriptionWithFallbackResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetPropertyDescriptions/GetPropertyDescriptionsResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetPropertyLabel/GetPropertyLabelResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetPropertyLabels/GetPropertyLabelsResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetPropertyStatements/GetPropertyStatementsResponse.php on lines 1..39
repo/rest-api/src/Application/UseCases/GetSitelink/GetSitelinkResponse.php on lines 1..39
repo/rest-api/src/Application/UseCases/GetSitelinks/GetSitelinksResponse.php on lines 1..39
repo/rest-api/src/Application/UseCases/GetStatement/GetStatementResponse.php on lines 1..44
repo/rest-api/src/Application/UseCases/PatchItem/PatchItemResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/PatchItemAliases/PatchItemAliasesResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/PatchItemDescriptions/PatchItemDescriptionsResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/PatchItemLabels/PatchItemLabelsResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/PatchProperty/PatchPropertyResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/PatchPropertyAliases/PatchPropertyAliasesResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/PatchPropertyDescriptions/PatchPropertyDescriptionsResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/PatchPropertyLabels/PatchPropertyLabelsResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/PatchSitelinks/PatchSitelinksResponse.php on lines 1..32
repo/rest-api/src/Application/UseCases/PatchStatement/PatchStatementResponse.php on lines 1..33
repo/rest-api/src/Application/UseCases/ReplaceStatement/ReplaceStatementResponse.php on lines 1..33
repo/rest-api/src/Domain/ReadModel/ItemRevision.php on lines 1..34
repo/rest-api/src/Domain/ReadModel/PropertyRevision.php on lines 1..34
repo/rest-api/src/Domain/ReadModel/StatementRevision.php on lines 1..34

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 106.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 41 locations. Consider refactoring.
Open

<?php declare( strict_types = 1 );

namespace Wikibase\Repo\RestApi\Application\UseCases\GetPropertyDescription;

use Wikibase\Repo\RestApi\Domain\ReadModel\Description;
repo/rest-api/src/Application/UseCases/AddItemStatement/AddItemStatementResponse.php on lines 1..33
repo/rest-api/src/Application/UseCases/AddPropertyStatement/AddPropertyStatementResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/CreateItem/CreateItemResponse.php on lines 1..38
repo/rest-api/src/Application/UseCases/CreateProperty/CreatePropertyResponse.php on lines 1..38
repo/rest-api/src/Application/UseCases/GetItem/GetItemResponse.php on lines 1..38
repo/rest-api/src/Application/UseCases/GetItemAliases/GetItemAliasesResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetItemAliasesInLanguage/GetItemAliasesInLanguageResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetItemDescription/GetItemDescriptionResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetItemDescriptionWithFallback/GetItemDescriptionWithFallbackResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetItemDescriptions/GetItemDescriptionsResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetItemLabel/GetItemLabelResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetItemLabelWithFallback/GetItemLabelWithFallbackResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetItemLabels/GetItemLabelsResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetItemStatements/GetItemStatementsResponse.php on lines 1..39
repo/rest-api/src/Application/UseCases/GetProperty/GetPropertyResponse.php on lines 1..38
repo/rest-api/src/Application/UseCases/GetPropertyAliases/GetPropertyAliasesResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetPropertyAliasesInLanguage/GetPropertyAliasesInLanguageResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetPropertyDescriptionWithFallback/GetPropertyDescriptionWithFallbackResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetPropertyDescriptions/GetPropertyDescriptionsResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetPropertyLabel/GetPropertyLabelResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetPropertyLabelWithFallback/GetPropertyLabelWithFallbackResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetPropertyLabels/GetPropertyLabelsResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/GetPropertyStatements/GetPropertyStatementsResponse.php on lines 1..39
repo/rest-api/src/Application/UseCases/GetSitelink/GetSitelinkResponse.php on lines 1..39
repo/rest-api/src/Application/UseCases/GetSitelinks/GetSitelinksResponse.php on lines 1..39
repo/rest-api/src/Application/UseCases/GetStatement/GetStatementResponse.php on lines 1..44
repo/rest-api/src/Application/UseCases/PatchItem/PatchItemResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/PatchItemAliases/PatchItemAliasesResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/PatchItemDescriptions/PatchItemDescriptionsResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/PatchItemLabels/PatchItemLabelsResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/PatchProperty/PatchPropertyResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/PatchPropertyAliases/PatchPropertyAliasesResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/PatchPropertyDescriptions/PatchPropertyDescriptionsResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/PatchPropertyLabels/PatchPropertyLabelsResponse.php on lines 1..34
repo/rest-api/src/Application/UseCases/PatchSitelinks/PatchSitelinksResponse.php on lines 1..32
repo/rest-api/src/Application/UseCases/PatchStatement/PatchStatementResponse.php on lines 1..33
repo/rest-api/src/Application/UseCases/ReplaceStatement/ReplaceStatementResponse.php on lines 1..33
repo/rest-api/src/Domain/ReadModel/ItemRevision.php on lines 1..34
repo/rest-api/src/Domain/ReadModel/PropertyRevision.php on lines 1..34
repo/rest-api/src/Domain/ReadModel/StatementRevision.php on lines 1..34

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 106.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function unsubscribe( string $subscriber, array $entityIds ): void {
        $unsubscriptions = $this->idsToString( $entityIds );
        $dbw = $this->connectionManager->getWriteConnection();
        $dbw->startAtomic( __METHOD__ );
        $oldSubscriptions = $this->querySubscriptions( $dbw, $subscriber, $unsubscriptions );
Severity: Major
Found in client/includes/Usage/Sql/SqlSubscriptionManager.php and 1 other location - About 1 hr to fix
client/includes/Usage/Sql/SqlSubscriptionManager.php on lines 54..62

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 106.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function subscribe( string $subscriber, array $entityIds ): void {
        $subscriptions = $this->idsToString( $entityIds );
        $dbw = $this->connectionManager->getWriteConnection();
        $dbw->startAtomic( __METHOD__ );
        $oldSubscriptions = $this->querySubscriptions( $dbw, $subscriber, $subscriptions );
Severity: Major
Found in client/includes/Usage/Sql/SqlSubscriptionManager.php and 1 other location - About 1 hr to fix
client/includes/Usage/Sql/SqlSubscriptionManager.php on lines 73..81

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 106.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function e163 has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

/***/ (function(module, exports, __webpack_require__) {

var has = __webpack_require__("5135");
var toObject = __webpack_require__("7b0b");
var sharedKey = __webpack_require__("f772");
Severity: Minor
Found in view/lib/wikibase-tainted-ref/dist/tainted-ref.common.js - About 1 hr to fix

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 06cf has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

/***/ (function(module, exports, __webpack_require__) {

var DESCRIPTORS = __webpack_require__("83ab");
var propertyIsEnumerableModule = __webpack_require__("d1e7");
var createPropertyDescriptor = __webpack_require__("5c6c");
Severity: Minor
Found in view/lib/wikibase-tainted-ref/dist/tainted-ref.common.js - About 1 hr to fix

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 ae93 has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

/***/ (function(module, exports, __webpack_require__) {

"use strict";

var fails = __webpack_require__("d039");
Severity: Minor
Found in view/lib/wikibase-tainted-ref/dist/tainted-ref.common.js - About 1 hr to fix

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 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

        EntityIdParser $entityIdParser,
        EntityLookup $entityLookup,
        UsageAccumulator $usageAccumulator,
        Serializer $entitySerializer,
        Serializer $statementSerializer,
Severity: Major
Found in client/includes/DataAccess/Scribunto/EntityAccessor.php - About 1 hr to fix

    Function getConflictsForItem has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getConflictsForItem( ItemId $itemId, SiteLinkList $siteLinkList, int $db = null ): array {
            $conflicts = [];
            $siteLinksToClear = [];
    
            foreach ( $siteLinkList->toArray() as $siteLink ) {
    Severity: Minor
    Found in repo/includes/Store/BagOStuffSiteLinkConflictLookup.php - About 1 hr to fix

    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 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function execute( $subPage ) {
            parent::execute( $subPage );
    
            $this->checkPermissions();
            $this->checkBlocked();
    Severity: Minor
    Found in repo/includes/Specials/SpecialMergeItems.php - About 1 hr to fix

    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 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function execute( $subPage ) {
            parent::execute( $subPage );
    
            $request = $this->getRequest();
            $subPageParts = $subPage ? explode( '/', $subPage, 2 ) : [];
    Severity: Minor
    Found in repo/includes/Specials/SpecialItemDisambiguation.php - About 1 hr to fix

    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 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            ApiMain $mainModule,
            string $moduleName,
            IBufferingStatsdDataFactory $stats,
            ApiHelperFactory $apiHelperFactory,
            DataTypeFactory $dataTypeFactory,
    Severity: Major
    Found in repo/includes/Api/ParseValue.php - About 1 hr to fix

      Method __construct has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              array $tags,
              ChangeOpFactoryProvider $changeOpFactoryProvider,
              SpecialPageCopyrightView $copyrightView,
              SummaryFormatter $summaryFormatter,
              EntityTitleLookup $entityTitleLookup,
      Severity: Major
      Found in repo/includes/Specials/SpecialSetLabel.php - About 1 hr to fix

        Method __construct has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                ApiMain $mainModule,
                string $moduleName,
                ApiErrorReporter $errorReporter,
                StatementChangeOpFactory $statementChangeOpFactory,
                StatementModificationHelper $modificationHelper,
        Severity: Major
        Found in repo/includes/Api/RemoveClaims.php - About 1 hr to fix

          Method factory has 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  HTMLCacheUpdater $htmlCacheUpdater,
                  EntityDataFormatProvider $entityDataFormatProvider,
                  EntityDataSerializationService $serializationService,
                  EntityDataUriManager $entityDataUriManager,
                  EntityIdParser $entityIdParser,
          Severity: Major
          Found in repo/includes/Specials/SpecialEntityData.php - About 1 hr to fix

            Method __construct has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    ApiMain $mainModule,
                    string $moduleName,
                    ApiErrorReporter $errorReporter,
                    StatementChangeOpFactory $statementChangeOpFactory,
                    StatementModificationHelper $modificationHelper,
            Severity: Major
            Found in repo/includes/Api/SetClaimValue.php - About 1 hr to fix

              Method __construct has 10 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      ApiMain $mainModule,
                      string $moduleName,
                      ApiErrorReporter $errorReporter,
                      StatementChangeOpFactory $statementChangeOpFactory,
                      StatementModificationHelper $modificationHelper,
              Severity: Major
              Found in repo/includes/Api/RemoveQualifiers.php - About 1 hr to fix

                Method __construct has 10 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        array $tags,
                        ChangeOpFactoryProvider $changeOpFactoryProvider,
                        SpecialPageCopyrightView $copyrightView,
                        SummaryFormatter $summaryFormatter,
                        EntityTitleLookup $entityTitleLookup,
                Severity: Major
                Found in repo/includes/Specials/SpecialSetAliases.php - About 1 hr to fix

                  Method __construct has 10 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          ApiMain $mainModule,
                          string $moduleName,
                          DataTypeFactory $dataTypeFactory,
                          ValueParserFactory $valueParserFactory,
                          DataTypeValidatorFactory $dataTypeValidatorFactory,
                  Severity: Major
                  Found in repo/includes/Api/ParseValue.php - About 1 hr to fix

                    Function validateFormData has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function validateFormData( array $formData ): Status {
                            $status = Status::newGood();
                    
                            if ( $formData[ self::FIELD_LABEL ] == ''
                                 && $formData[ self::FIELD_DESCRIPTION ] == ''
                    Severity: Minor
                    Found in repo/includes/Specials/SpecialNewItem.php - About 1 hr to fix

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language