wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 2,096 of 2,096 total issues

Function 69f3 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

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

var NATIVE_WEAK_MAP = __webpack_require__("7f9a");
var global = __webpack_require__("da84");
var isObject = __webpack_require__("861d");
Severity: Minor
Found in view/lib/wikibase-tainted-ref/dist/tainted-ref.common.js - About 35 mins 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 da84 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

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

/* WEBPACK VAR INJECTION */(function(global) {var check = function (it) {
  return it && it.Math == Math && it;
};
Severity: Minor
Found in view/lib/wikibase-tainted-ref/dist/tainted-ref.common.js - About 35 mins 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 mergeChanges has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function mergeChanges( EntityId $entityId, array $changes ) {
        if ( count( $changes ) === 1 ) {
            return reset( $changes );
        }

Severity: Minor
Found in client/includes/Changes/ChangeRunCoalescer.php - About 35 mins 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 getOtherProjectsSiteIds has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getOtherProjectsSiteIds( array $siteLinkGroups ) {
        $localSite = $this->getLocalSite();

        if ( $localSite === null ) {
            wfWarn( 'Site not found for ' . $this->localSiteId );
Severity: Minor
Found in client/includes/OtherProjectsSitesGenerator.php - About 35 mins 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 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] ) ) {
Severity: Minor
Found in client/includes/Api/PageTerms.php - About 35 mins 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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function render(
        EntityId $entityId,
        $propertyLabelOrId,
        array $acceptableRanks = null
    ) {
Severity: Minor
Found in client/includes/DataAccess/StatementTransclusionInteractor.php - About 35 mins 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 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 );

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();
Severity: Minor
Found in repo/includes/Store/Sql/SqlEntityIdPager.php - About 35 mins 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 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 );

Severity: Minor
Found in client/includes/Hooks/LangLinkHandler.php - About 35 mins 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 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;
Severity: Minor
Found in client/includes/Hooks/LangLinkHandler.php - About 35 mins 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 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(),
Severity: Minor
Found in repo/includes/Store/BagOStuffSiteLinkConflictLookup.php - About 35 mins 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 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'] ) ) {
Severity: Minor
Found in repo/includes/Actions/ViewEntityAction.php - About 35 mins 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 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();

Severity: Minor
Found in client/includes/Usage/Sql/EntityUsageTable.php - About 35 mins 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 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;
            }
Severity: Minor
Found in repo/includes/ArrayValueCollector.php - About 35 mins 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 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 ) {
Severity: Minor
Found in client/includes/Hooks/LangLinkHandler.php - About 35 mins 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 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 [];
        }

Severity: Minor
Found in repo/includes/Store/Sql/SqlSiteLinkConflictLookup.php - About 35 mins 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 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();
Severity: Minor
Found in repo/includes/Actions/ViewEntityAction.php - About 35 mins 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 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,
Severity: Minor
Found in repo/includes/Interactors/EntityRedirectCreationInteractor.php - About 35 mins 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 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 );
Severity: Minor
Found in repo/includes/Api/EntityIdSearchHelper.php - About 35 mins 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 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' ],
Severity: Minor
Found in repo/includes/Api/CreateClaim.php - About 35 mins 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