wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 2,096 of 2,096 total issues

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

    private function getEditCommentMulti( EntityChange $change, Title $target = null ) {
        $info = $change->getInfo();

        if ( isset( $info['changes'] ) ) {
            if ( $info['changes'] === [] ) {
Severity: Minor
Found in client/includes/RecentChanges/RecentChangeFactory.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() {
        $referenceJson = $this->getParameter( 'reference' );
        $referenceJsonStatus = FormatJson::parse( $referenceJson, FormatJson::FORCE_ASSOC );

        if ( !$referenceJsonStatus->isGood() ) {
Severity: Minor
Found in client/includes/Api/ApiFormatReference.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 prepareChangeAttributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function prepareChangeAttributes( EntityChange $change ) {
        $rcinfo = $change->getMetadata();

        $fields = $change->getFields();
        $fields['entity_type'] = $change->getEntityId()->getEntityType();
Severity: Minor
Found in client/includes/RecentChanges/RecentChangeFactory.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 addFilter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function addFilter( ChangesListSpecialPage $specialPage ): void {
        $filterName = $this->getFilterName();
        $changeTypeGroup = $specialPage->getFilterGroup( 'changeType' );

        $out = $specialPage->getOutput();
Severity: Minor
Found in client/includes/Hooks/ChangesListSpecialPageHookHandler.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 getClientUserId has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function getClientUserId( $repoUserId, array $metadata, bool $changeComesFromLocalDb ) {
        if ( $repoUserId === 0 ) {
            // Logged out on repo just copied to client
            return 0;
        }
Severity: Minor
Found in client/includes/RecentChanges/RecentChangeFactory.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 injectRCRecords has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function injectRCRecords( array $titles, EntityChange $change, array $rootJobParams = [] ) {
        if ( $titles === [] ) {
            return;
        }

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

    public function getLink( Title $title, $action, $hasLangLinks, ?array $noExternalLangLinks, $prefixedId ) {
        if ( $this->canHaveLink( $title, $action, $noExternalLangLinks ) ) {
            $entityId = null;

            if ( is_string( $prefixedId ) ) {
Severity: Minor
Found in client/includes/RepoItemLinkGenerator.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 renumber has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function renumber( array &$entityArr ) {
        foreach ( $entityArr as &$value ) {
            if ( !is_array( $value ) ) {
                continue;
            }
Severity: Minor
Found in client/includes/DataAccess/Scribunto/EntityAccessor.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 onPageMoveComplete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function onPageMoveComplete(
        $oldLinkTarget,
        $newLinkTarget,
        $userIdentity,
        $pageId,
Severity: Minor
Found in client/includes/Hooks/UpdateRepoHookHandler.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 {
        foreach ( $termTypes as $termType ) {
            foreach ( $languageCodes as $languageCode ) {
                $key = $this->getKey( $entityId, $termType, $languageCode );
                if ( !isset( $this->termKeys[$key] ) ) {
Severity: Minor
Found in repo/includes/FederatedProperties/ApiPrefetchingTermLookup.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 indexLinksByInterwiki has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function indexLinksByInterwiki( array $links ) {
        $indexed = [];

        foreach ( $links as $link ) {
            $siteId = $link->getSiteId();
Severity: Minor
Found in client/includes/Hooks/LangLinkHandler.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 rebuild has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

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

        foreach ( $this->getIdBatches() as $itemIds ) {
            $this->progressReporter->reportMessage(
Severity: Minor
Found in repo/includes/Store/ItemTermsRebuilder.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 getOrCreatePingbackId has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function getOrCreatePingbackId() {
        if ( !$this->id ) {
            $dbr = $this->repoConnections->getReadConnection();

            $id = $dbr->newSelectQueryBuilder()
Severity: Minor
Found in repo/includes/WikibasePingback.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 extractSummaryProperties has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function extractSummaryProperties( $result ): array {
        $propertyIds = [];
        foreach ( $result as $revisionRow ) {
            $comment = $this->getCommentText( $revisionRow );
            if ( $comment === null ) {
Severity: Minor
Found in repo/includes/FederatedProperties/SummaryParsingPrefetchHelper.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 onOutputPageParserOutput has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function onOutputPageParserOutput( $outputPage, $parserOutput ): void {
        $title = $outputPage->getTitle();
        if ( !$title || !$this->namespaceChecker->isWikibaseEnabled( $title->getNamespace() ) ) {
            // shorten out
            return;
Severity: Minor
Found in client/includes/Hooks/SidebarHookHandler.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 generateOpHtml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function generateOpHtml( array $path, DiffOp $op ): string {
        if ( $op instanceof AtomicDiffOp ) {
            $localizedPath = $path;

            $translatedLinkSubPath = $this->messageLocalizer->msg(
Severity: Minor
Found in repo/includes/Diff/SiteLinkDiffView.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 onLoadExtensionSchemaUpdates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function onLoadExtensionSchemaUpdates( $updater ) {
        $db = $updater->getDB();
        $type = $db->getType();

        if ( $type !== 'mysql' && $type !== 'sqlite' && $type !== 'postgres' ) {
Severity: Minor
Found in repo/includes/Store/Sql/DatabaseSchemaUpdater.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 buildPreliminarySidebarFromSiteLinks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function buildPreliminarySidebarFromSiteLinks( array $siteLinks ) {
        $linksByGroup = [];

        foreach ( $siteLinks as $siteLink ) {
            if ( !in_array( $siteLink->getSiteId(), $this->siteIdsToOutput ) ) {
Severity: Minor
Found in client/includes/Hooks/OtherProjectsSidebarGenerator.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 addJsModules has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function addJsModules( OutputPage $outputPage, Title $title, $actionName, Skin $skin ): void {
        $user = $outputPage->getUser();

        if ( $this->hasLinkItemWidget( $user, $outputPage, $title, $actionName ) ) {
            // Add the JavaScript which lazy-loads the link item widget
Severity: Minor
Found in client/includes/Hooks/BeforePageDisplayHandler.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 onSidebarBeforeOutput has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function onSidebarBeforeOutput( $skin, &$sidebar ): void {
        // Add the 'In other projects' section
        $otherProjectsSidebar = $this->buildOtherProjectsSidebar( $skin );
        $sidebar['wikibase-otherprojects'] = $otherProjectsSidebar === null ? [] : $otherProjectsSidebar;

Severity: Minor
Found in client/includes/Hooks/SidebarHookHandler.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