wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 2,096 of 2,096 total issues

Method assertConstructFieldsAreCorrect has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function assertConstructFieldsAreCorrect( array $fields ) {
        Assert::parameter(
            count( $fields ) === count( self::FIELD_NAMES ) &&
            !array_diff( self::FIELD_NAMES, array_keys( $fields ) ),
            '$fields',
Severity: Minor
Found in lib/includes/TermIndexEntry.php - About 1 hr to fix

    Function mwApiRejectionToError has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private mwApiRejectionToError( code: string, arg2: unknown, _arg3: unknown, _arg4: unknown ): never {
            switch ( code ) {
                case 'http': { // jQuery AJAX failure
                    const detail = arg2 as {
                        xhr: jqXHR;
    Severity: Minor
    Found in client/data-bridge/src/data-access/ApiCore.ts - About 1 hr to fix

      Function dispatch has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public dispatch( selectedElement: SelectedElement ): void {
              const dialog = prepareContainer( this.mwWindow.OO, this.mwWindow.$, Dispatcher.APP_DOM_CONTAINER_ID );
      
              const emitter = this.app.launch(
                  ( this.vue as MwVueConstructor ).createMwApp,
      Severity: Minor
      Found in client/data-bridge/src/mediawiki/Dispatcher.ts - About 1 hr to fix

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            protected function initRepoJobServicesFromGlobalState(): void {
                $services = MediaWikiServices::getInstance();
        
                $this->initServices(
                    WikibaseRepo::getStore( $services )->getEntityLookup(
        Severity: Major
        Found in repo/includes/UpdateRepo/UpdateRepoOnMoveJob.php and 1 other location - About 1 hr to fix
        repo/includes/UpdateRepo/UpdateRepoOnDeleteJob.php on lines 60..75

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 102.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            protected function initRepoJobServicesFromGlobalState(): void {
                $services = MediaWikiServices::getInstance();
        
                $this->initServices(
                    WikibaseRepo::getStore( $services )->getEntityLookup(
        Severity: Major
        Found in repo/includes/UpdateRepo/UpdateRepoOnDeleteJob.php and 1 other location - About 1 hr to fix
        repo/includes/UpdateRepo/UpdateRepoOnMoveJob.php on lines 65..80

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 102.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            private function generateAddedCells() {
                $html = Html::element( 'td', [ 'class' => 'diff-marker', 'data-marker' => '+' ] );
                $html .= Html::rawElement( 'td', [ 'class' => 'diff-addedline' ],
                    Html::rawElement( 'div', [],
                        Html::rawElement( 'ins', [ 'class' => 'diffchange diffchange-inline' ],
        Severity: Major
        Found in repo/includes/Diff/DiffOpValueFormatter.php and 1 other location - About 1 hr to fix
        repo/includes/Diff/DiffOpValueFormatter.php on lines 67..78

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 102.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                if ( $this->label !== '' ) {
                    if ( !$fingerprint->hasLabel( $this->languageCode )
                        || $fingerprint->getLabel( $this->languageCode )->getText() !== $this->label
                    ) {
                        $changeOps['wbsetlabel'] = $changeOpFactory->newSetLabelOp(
        repo/includes/Specials/SpecialSetLabelDescriptionAliases.php on lines 486..499

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 102.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            private function generateDeletedCells() {
                $html = Html::element( 'td', [ 'class' => 'diff-marker', 'data-marker' => '−' ] );
                $html .= Html::rawElement( 'td', [ 'class' => 'diff-deletedline' ],
                    Html::rawElement( 'div', [],
                        Html::rawElement( 'del', [ 'class' => 'diffchange diffchange-inline' ],
        Severity: Major
        Found in repo/includes/Diff/DiffOpValueFormatter.php and 1 other location - About 1 hr to fix
        repo/includes/Diff/DiffOpValueFormatter.php on lines 83..94

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 102.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                if ( $this->description !== '' ) {
                    if ( !$fingerprint->hasDescription( $this->languageCode )
                        || $fingerprint->getDescription( $this->languageCode )->getText() !== $this->description
                    ) {
                        $changeOps['wbsetdescription'] = $changeOpFactory->newSetDescriptionOp(
        repo/includes/Specials/SpecialSetLabelDescriptionAliases.php on lines 471..484

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 102.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            Item = util.inherit(
                $.ui.ooMenu.Item,
                Item,
                {
                    /**
        view/resources/jquery/wikibase/jquery.wikibase.entityselector.js on lines 741..758

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 56.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            Item = util.inherit(
                $.ui.ooMenu.Item,
                Item,
                {
                    /**
        view/resources/jquery/wikibase/jquery.wikibase.siteselector.js on lines 354..370

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 56.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function _onSuccess has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                _onSuccess: function () {
                    var mwApi = new mw.Api(),
                        itemUri = this._linkRepoTitle(
                            'Special:ItemByTitle/' + this.options.globalSiteId + '/' + this.options.pageTitle
                        );
        Severity: Minor
        Found in client/resources/jquery.wikibase/jquery.wikibase.linkitem.js - About 1 hr to fix

          Function _createReferencesListview has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  _createReferencesListview: function ( references ) {
                      var self = this;
          
                      var $listview = this.$references.children( '.wikibase-listview' );
                      if ( !$listview.length ) {
          Severity: Minor
          Found in view/resources/jquery/wikibase/jquery.wikibase.statementview.js - About 1 hr to fix

            Function _initMenu has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    _initMenu: function ( ooMenu ) {
                        var self = this;
            
                        $.ui.suggester.prototype._initMenu.apply( this, arguments );
            
            
            Severity: Minor
            Found in client/resources/jquery.wikibase/jquery.wikibase.siteselector.js - About 1 hr to fix

              Function _initMenu has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      _initMenu: function ( ooMenu ) {
                          var self = this;
              
                          $.ui.suggester.prototype._initMenu.apply( this, arguments );
              
              
              Severity: Minor
              Found in view/resources/jquery/wikibase/jquery.wikibase.siteselector.js - About 1 hr to fix

                Function _createStatementlistview has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        _createStatementlistview: function () {
                            var self = this,
                                prefix;
                
                            var $statementlistview = this.element.find( '.wikibase-statementlistview' );

                  Method getBadges has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getBadges( string $prefixedItemId, ?string $globalSiteId ): array {
                          $globalSiteId = $globalSiteId ?: $this->siteId;
                  
                          try {
                              $itemId = new ItemId( $prefixedItemId );

                    Method getCentralDescriptions has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function getCentralDescriptions( array $titlesByPageId ) {
                            if ( !$titlesByPageId ) {
                                return [];
                            }
                    
                    
                    Severity: Minor
                    Found in client/includes/Store/DescriptionLookup.php - About 1 hr to fix

                      Method newEntityRevisionLookup has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function newEntityRevisionLookup() {
                              // Maintain a list of watchers to be notified of changes to any entities,
                              // in order to update caches.
                              /** @var WikiPageEntityStore $dispatcher */
                              $dispatcher = $this->getEntityStoreWatcher();
                      Severity: Minor
                      Found in repo/includes/Store/Sql/SqlStore.php - About 1 hr to fix

                        Method getUsagesForPage has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getUsagesForPage( int $pageId ): array {
                                $usages = $this->usageLookup->getUsagesForPage( $pageId );
                                $title = $this->titleFactory->newFromID( $pageId );
                                if ( !$title ) {
                                    return $usages;
                        Severity: Minor
                        Found in client/includes/Usage/ImplicitDescriptionUsageLookup.php - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language