wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 2,096 of 2,096 total issues

Function mapToTermInLangIds has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function mapToTermInLangIds(
        array $termsArray,
        ReplicaPrimaryAwareRecordIdsAcquirer $termInLangIdsAcquirer,
        array $idsToRestore = []
    ) {
Severity: Minor
Found in lib/includes/Store/Sql/Terms/DatabaseTermInLangIdsAcquirer.php - About 25 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 parseWellKnownProperty has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static function parseWellKnownProperty(
        array $wellKnownPropertyIds,
        string $wellKnownName,
        LoggerInterface $logger
    ): ?NumericPropertyId {
Severity: Minor
Found in lib/includes/Formatters/Reference/WellKnownReferenceProperties.php - About 25 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 getSummaryMessage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function getSummaryMessage( $name ) {
        if ( isset( $this->messages[$name] ) ) {
            return $this->messages[$name];
        }

Severity: Minor
Found in lib/includes/Formatters/AutoCommentFormatter.php - About 25 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 prefetch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function prefetch( array $entityIds ) {
        $entityIdCount = count( $entityIds );

        if ( $entityIdCount > $this->cache->getMaxSize() ) {
            // Ouch... fetching everything wouldn't fit into the cache, thus
Severity: Minor
Found in lib/includes/Store/Sql/PrefetchingWikiPageEntityMetaDataAccessor.php - About 25 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 buildTermResult has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function buildTermResult( array $results, ?int $limit = null ): array {
        $matchingTerms = [];
        // Union in SQL doesn't have limit, we need to enforce it here
        $counter = 0;

Severity: Minor
Found in lib/includes/Store/Sql/Terms/DatabaseMatchingTermsLookup.php - About 25 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 addInterwikiIdsToGroup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function addInterwikiIdsToGroup( array $sites, $siteGroup ) {
        foreach ( $sites as $site ) {
            if ( $site->getGroup() === $siteGroup ) {
                $localId = $site->getLanguageCode();

Severity: Minor
Found in lib/includes/Sites/SitesBuilder.php - About 25 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 getByPropertyId has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getByPropertyId( ?PropertyId $certainPropertyId ): array {
        if ( $certainPropertyId === null ) {
            if ( $this->hasUnknownPropertyId ) {
                return [];
            } else {
Severity: Minor
Found in lib/includes/Formatters/Reference/ByCertainPropertyIdGrouper.php - About 25 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 formatReference has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function formatReference( Reference $reference ): string {
        $referenceSnaks = new ByCertainPropertyIdGrouper( $reference->getSnaks(), [
            $this->properties->referenceUrlPropertyId,
            $this->properties->titlePropertyId,
            $this->properties->statedInPropertyId,
Severity: Minor
Found in lib/includes/Formatters/Reference/DataBridgeReferenceFormatter.php - About 25 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 getMultipleTermsByLanguageFromCache has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function getMultipleTermsByLanguageFromCache( EntityId $entityId, string $termType, array $languages ) {
        $terms = [];

        $languagesToCacheKeys = [];

Severity: Minor
Found in lib/includes/Store/CachingPrefetchingTermLookup.php - About 25 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 getLinks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getLinks(
        ?array $numericIds = null,
        ?array $siteIds = null,
        ?array $pageNames = null
    ): array {
Severity: Minor
Found in lib/includes/Store/HashSiteLinkStore.php - About 25 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 moveObjectToIndex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function moveObjectToIndex( $object, $toIndex ) {
        $this->assertIndexIsBuild();

        if ( !in_array( $object, $this->toFlatArray() ) ) {
            throw new OutOfBoundsException( 'Object not present in array' );
Severity: Minor
Found in lib/packages/wikibase/data-model/src/ByPropertyIdArray.php - About 25 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 getMultiple has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getMultiple( $keys, $default = null ) {
        $values = $this->inner->getMultiple( $keys, self::DEFAULT_VALUE );
        $misses = 0;
        $hits = 0;

Severity: Minor
Found in lib/includes/StatsdRecordingSimpleCache.php - About 25 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 equals has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function equals( $target ) {
        if ( $this === $target ) {
            return true;
        }

Severity: Minor
Found in lib/packages/wikibase/data-model/src/Term/AliasGroupList.php - About 25 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 newFromUpdate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function newFromUpdate(
        $action,
        EntityDocument $oldEntity = null,
        EntityDocument $newEntity = null
    ): EntityChange {
Severity: Minor
Found in lib/packages/wikibase/changes/src/EntityChangeFactory.php - About 25 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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $stripProtocols = (bool)$this->getOption( 'strip-protocols', false );
        $forceProtocol = $this->getOption( 'force-protocol', null );
        $url = $this->getOption( 'load-from', 'https://meta.wikimedia.org/w/api.php' );
        $scriptPath = $this->getOption( 'script-path', '/w/$1' );
Severity: Minor
Found in lib/maintenance/populateSitesTable.php - About 25 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 equals has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function equals( $target ) {
        if ( $this === $target ) {
            return true;
        }

Severity: Minor
Found in lib/packages/wikibase/data-model/src/Term/TermList.php - About 25 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