wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 2,096 of 2,096 total issues

Function addEntityRevision has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function addEntityRevision(
        $sourceEntityIdSerialization,
        EntityRevision $entityRevision,
        $props = 'all',
        array $filterSiteIds = null,
Severity: Minor
Found in repo/includes/Api/ResultBuilder.php - About 55 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 getForm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getForm( EntityDocument $entity = null ) {
        if ( $this->page === null ) {
            $this->page = $this->site === null ? '' : $this->getSiteLink( $entity, $this->site );
        }
        if ( !$this->badges ) {
Severity: Minor
Found in repo/includes/Specials/SpecialSetSiteLink.php - About 55 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 saveRedirect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function saveRedirect(
        EntityRedirect $redirect,
        FormatableSummary $summary,
        IContextSource $context,
        bool $bot,
Severity: Minor
Found in repo/includes/Interactors/EntityRedirectCreationInteractor.php - About 55 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 createEntity has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function createEntity( $entityType, EntityId $customId = null, $assignFreshId = self::ASSIGN_FRESH_ID ): EntityDocument {
        if ( $customId ) {
            $entityType = $customId->getEntityType();
        } elseif ( !$entityType ) {
            $this->errorReporter->dieError(
Severity: Minor
Found in repo/includes/Api/EntitySavingHelper.php - About 55 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 modifyEntity has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function modifyEntity( EntityDocument $entity, ChangeOp $changeOp, array $preparedParameters ): Summary {
        if ( !( $entity instanceof Item ) ) {
            $this->errorReporter->dieError( "The given entity is not an item", "not-item" );
        }

Severity: Minor
Found in repo/includes/Api/SetSiteLink.php - About 55 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 resolveMentionedEntities has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function resolveMentionedEntities(): void {
        $hasRedirect = false;

        $this->markStubEntityDataForPrefetching( $this->entitiesResolved );

Severity: Minor
Found in repo/includes/Rdf/RdfBuilder.php - About 55 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 onShowSearchHit has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function onShowSearchHit( $searchPage, $result,
        $terms, &$link, &$redirect, &$section, &$extract, &$score, &$size, &$date, &$related,
        &$html
    ): void {
        if ( $result instanceof ExtendedResult ) {
Severity: Minor
Found in repo/includes/Hooks/ShowSearchHitHandler.php - About 55 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 addEntityPageProps has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function addEntityPageProps( EntityDocument $entity ): void {
        if ( !$this->shouldProduce( RdfProducer::PRODUCE_PAGE_PROPS ) ) {
            return;
        }
        $pagePropertyDefs = $this->getPagePropertyDefs();
Severity: Minor
Found in repo/includes/Rdf/RdfBuilder.php - About 55 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 validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate( EntityDocument $entity ) {
        $languageValidator = $this->termValidatorFactory->getAliasLanguageValidator();
        $termValidator = $this->termValidatorFactory->getAliasValidator();

        // check that the language is valid
Severity: Minor
Found in repo/includes/ChangeOp/ChangeOpAliases.php - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $newJsonName = $this->getOption( 'config' );
        $newJson = json_decode( file_get_contents( $newJsonName ), true );
        if ( !$newJson ) {
            $this->fatalError( "Cannot load new config" );
Severity: Minor
Found in repo/maintenance/addUnitConversions.php - About 55 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 rebuild has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function rebuild() {
        $ticket = $this->db->getEmptyTransactionTicket( __METHOD__ );

        $counter = 0;
        while ( true ) {
Severity: Minor
Found in repo/maintenance/EntityQuantityUnitRebuilder.php - About 55 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 getIdentifiersCount has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getIdentifiersCount( StatementList $statementList ): int {
        $identifiers = 0;
        foreach ( $statementList as $statement ) {
            $propertyId = $statement->getPropertyId();
            $propertyIdSerialization = $propertyId->getSerialization();
Severity: Minor
Found in repo/includes/Content/ItemHandler.php - About 55 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 validate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate(
        ?string $itemId,
        string $siteId,
        array $sitelink,
        string $basePath = ''
Severity: Minor
Found in repo/rest-api/src/Infrastructure/SiteLinkLookupSitelinkValidator.php - About 55 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 getTitlesForIds has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function getTitlesForIds( array $ids ): array {
        Assert::parameterElementType( EntityId::class, $ids, '$ids' );
        $titles = [];
        $idsByType = [];
        // get whatever federated ids or cached ids we can, and batch the rest of the ids by type
Severity: Minor
Found in repo/includes/Content/ContentHandlerEntityTitleLookup.php - About 55 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 findPrimaryCoordinateKey has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function findPrimaryCoordinateKey() {
        foreach ( $this->preferredPropertiesIds as $id ) {
            $key = $this->makeCoordinateKey( $id, Statement::RANK_PREFERRED );
            $preferredCount = $this->getCoordinatesGroupCount( $key );

Severity: Minor
Found in repo/includes/ParserOutput/GeoDataDataUpdater.php - About 55 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 deserialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function deserialize( array $serialization, string $basePath ): array {
        if ( !count( $serialization ) || !array_is_list( $serialization ) ) {
            $parts = explode( '/', $basePath );
            throw new InvalidFieldException( $parts[array_key_last( $parts )], $serialization, $basePath );
        }

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

    public function getHtml( TermFallback $term ) {
        $requestedLanguage = $term->getLanguageCode();
        $actualLanguage = $term->getActualLanguageCode();
        $sourceLanguage = $term->getSourceLanguageCode();

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

    public function __construct( array $fields = [] ) {
        Assert::parameter(
            !array_diff( array_keys( $fields ), self::FIELD_NAMES ),
            '$fields',
            'must only contain the following keys: termType, termLanguage, termText'
Severity: Minor
Found in lib/includes/Store/TermIndexSearchCriteria.php - About 55 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 toStandardUnits has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function toStandardUnits( UnboundedQuantityValue $value ) {
        $fromUnit = $value->getUnit();

        if ( $fromUnit === '1' ) {
            // Won't convert unitless values
Severity: Minor
Found in lib/includes/Units/UnitConverter.php - About 55 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 9 (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/Sql/SiteLinkTable.php - About 55 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