wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 1,432 of 2,096 total issues

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

    private function generateReferencesChangeOps( Statement $fromStatement, Statement $toStatement ) {
        $changeOps = new ChangeOps();

        /** @var Reference $reference */
        foreach ( $fromStatement->getReferences() as $reference ) {
Severity: Minor
Found in repo/includes/Merge/StatementsMerger.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 addSecondaryCoordinates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function addSecondaryCoordinates(
        CoordinatesOutput $coordinatesOutput,
        $primaryCoordKey
    ) {
        foreach ( $this->coordinates as $key => $coords ) {
Severity: Minor
Found in repo/includes/ParserOutput/GeoDataDataUpdater.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 reconvertOutputString has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function reconvertOutputString( $value, Language $lang ) {
        foreach ( self::PRECISION_MSG_KEYS as $precision => $msgKeysGroup ) {
            foreach ( $msgKeysGroup as $msgKey ) {
                $res = $this->parseFromOutputString(
                    $lang,
Severity: Minor
Found in repo/includes/Parsers/MwTimeIsoParser.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 processSnak has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function processSnak( Snak $snak, PropertyId $propertyId, $rank ) {
        $fileName = $this->getString( $snak );
        if ( $fileName === null || $fileName === '' ) {
            return;
        }
Severity: Minor
Found in repo/includes/ParserOutput/PageImagesDataUpdater.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 processStatement has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function processStatement( Statement $statement ) {
        $propertyId = $statement->getPropertyId();

        if ( $this->propertyDataTypeMatcher->isMatchingDataType(
            $propertyId,
Severity: Minor
Found in repo/includes/ParserOutput/GeoDataDataUpdater.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 getMwDateFormatParser has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getMwDateFormatParser(
        $languageCode = 'en',
        $dateFormatPreference = 'dmy',
        $dateFormatType = 'date',
        ParserOptions $options = null
Severity: Minor
Found in repo/includes/Parsers/MwDateFormatParserFactory.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 validateTopLevelFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function validateTopLevelFields( array $property ): void {
        if (
            !is_string( $property['data_type'] ) ||
            !in_array( $property['data_type'], $this->dataTypesArray )
        ) {

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

    private function cleanTermInLangIdsInner( array $termInLangIds ): void {
        $this->logger->debug(
            '{method}: deleting {count} term_in_lang rows',
            [
                'method' => __METHOD__,
Severity: Minor
Found in lib/includes/Store/Sql/Terms/DatabaseInnerTermStoreCleaner.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 getSetting has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getSetting( $settingName ) {
        if ( !$this->offsetExists( $settingName ) && !property_exists( $this, $settingName ) ) {
            throw new OutOfBoundsException( 'Attempt to get non-existing setting "' . $settingName . '"' );
        }

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

    public function format( $conceptUri ) {
        if ( !is_string( $conceptUri ) ) {
            throw new InvalidArgumentException( '$conceptUri must be a string' );
        }

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

    public function getContent( EntityId $entityId, $revision, $language, $editLink, TermLanguageFallbackChain $preferredLanguages ) {
        try {
            $request = $this->requestFactory->create(
                $this->formatUrl( $entityId, $revision, $language, $editLink, $preferredLanguages ),
                [ 'timeout' => $this->ssrServerTimeout ],
Severity: Minor
Found in view/src/Termbox/Renderer/TermboxRemoteRenderer.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 calendarNameNeeded has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function calendarNameNeeded( TimeValue $value ): bool {
        // Do not care about possibly wrong calendar models with precision 10 years and more.
        if ( $value->getPrecision() <= TimeValue::PRECISION_YEAR10 ) {
            return false;
        }
Severity: Minor
Found in lib/includes/Formatters/ShowCalendarModelDecider.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 isPrefetched has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function isPrefetched(
        EntityId $entityId,
        array $termTypes,
        array $languageCodes
    ): bool {
Severity: Minor
Found in lib/includes/Store/Sql/Terms/PrefetchingEntityTermLookupBase.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 filterDisabledDataTypes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function filterDisabledDataTypes( array $dataTypeDefinitions, array $disabledTypes ) {
        foreach ( $dataTypeDefinitions as $id => $def ) {
            if ( strpos( $id, 'PT' ) === 0 ) {
                if ( in_array( substr( $id, 3 ), $disabledTypes ) ) {
                    unset( $dataTypeDefinitions[$id] );
Severity: Minor
Found in lib/includes/DataTypeDefinitions.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 setKeys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function setKeys( array $entityIds, array $termTypes, array $languageCodes ): void {
        foreach ( $entityIds as $entityId ) {
            foreach ( $termTypes as $termType ) {
                foreach ( $languageCodes as $languageCode ) {
                    $key = $this->getKey( $entityId, $termType, $languageCode );
Severity: Minor
Found in lib/includes/Store/Sql/Terms/PrefetchingEntityTermLookupBase.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 getCallbackToAddDataTypeToSnaksGroupedByProperty has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getCallbackToAddDataTypeToSnaksGroupedByProperty(
        PropertyDataTypeLookup $dataTypeLookup,
        EntityIdParser $entityIdParser
    ) {
        return function ( $array ) use ( $dataTypeLookup, $entityIdParser ) {
Severity: Minor
Found in lib/includes/Serialization/CallbackFactory.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 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

Severity
Category
Status
Source
Language