wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 2,096 of 2,096 total issues

Method getUnexpectedUnconnectedBatch has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function getUnexpectedUnconnectedBatch(): array {
        $dbr = $this->localConnectionManager->getReadConnection();

        $lastPosition = $this->position + $this->batchSize * $this->batchSizeSelectMultiplicator;
        $result = $dbr->newSelectQueryBuilder()
Severity: Minor
Found in client/includes/Store/Sql/UnexpectedUnconnectedPagePrimer.php - About 1 hr to fix

    Method newEntityDiffVisualizer has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function newEntityDiffVisualizer( ?string $type = null, ?IContextSource $context = null ): EntityDiffVisualizer {
            if ( $context === null ) {
                $context = RequestContext::getMain();
            }
            $langCode = $context->getLanguage()->getCode();
    Severity: Minor
    Found in repo/includes/Diff/EntityDiffVisualizerFactory.php - About 1 hr to fix

      Method visualizeReferenceChanges has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function visualizeReferenceChanges(
              $headerPrefix,
              Diff $changes,
              Snak $oldestMainSnak,
              Snak $newestMainSnak
      Severity: Minor
      Found in repo/includes/Diff/ClaimDifferenceVisualizer.php - About 1 hr to fix

        Method findImplicitUsages has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function findImplicitUsages( array $entityIds ): array {
                $numericItemIds = [];
                foreach ( $entityIds as $entityId ) {
                    if ( $entityId instanceof ItemId ) {
                        $numericItemIds[] = $entityId->getNumericId();
        Severity: Minor
        Found in client/includes/Usage/ImplicitDescriptionUsageLookup.php - About 1 hr to fix

          Method visualizeQualifierChanges has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function visualizeQualifierChanges(
                  $headerPrefix,
                  Diff $changes,
                  Snak $oldestMainSnak,
                  Snak $newestMainSnak
          Severity: Minor
          Found in repo/includes/Diff/ClaimDifferenceVisualizer.php - About 1 hr to fix

            Method mergeItems has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function mergeItems(
                    ItemId $fromId,
                    ItemId $toId,
                    IContextSource $context,
                    array $ignoreConflicts = [],
            Severity: Minor
            Found in repo/includes/Interactors/ItemMergeInteractor.php - About 1 hr to fix

              Method formatRow has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function formatRow( EntityId $propertyId ) {
                      $title = $this->titleLookup->getTitleForId( $propertyId );
                      $language = $this->getLanguage();
              
                      if ( !$title->exists() ) {
              Severity: Minor
              Found in repo/includes/Specials/SpecialListProperties.php - About 1 hr to fix

                Method onApiCheckCanExecute has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function onApiCheckCanExecute( ApiBase $module, User $user, &$message ) {
                        if ( $module instanceof ApiEditPage ) {
                            $params = $module->extractRequestParams();
                            $pageObj = $module->getTitleOrPageId( $params );
                            $namespace = $pageObj->getTitle()->getNamespace();
                Severity: Minor
                Found in repo/includes/RepoHooks.php - About 1 hr to fix

                  Method getAllowedParams has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function getAllowedParams(): array {
                          return array_merge(
                              [
                                  'statement' => [
                                      ParamValidator::PARAM_TYPE => 'string',
                  Severity: Minor
                  Found in repo/includes/Api/SetReference.php - About 1 hr to fix

                    Method deserialize has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function deserialize( string $siteId, array $serialization, string $basePath = '' ): SiteLink {
                            if ( !array_key_exists( 'title', $serialization ) ) {
                                throw new MissingFieldException( 'title', $basePath );
                            }
                    
                    

                      Method handleDescriptionsValidationError has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function handleDescriptionsValidationError( ValidationError $validationError ): void {
                              $context = $validationError->getContext();
                      
                              switch ( $validationError->getCode() ) {
                                  case DescriptionsSyntaxValidator::CODE_DESCRIPTIONS_NOT_ASSOCIATIVE:

                        Method updateQueryBuilder has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function updateQueryBuilder( SelectQueryBuilder $queryBuilder, array $entityIds, IReadableDatabase $db ) {
                                $where = [];
                                $joinSlotsTable = false;
                        
                                foreach ( $entityIds as $entityId ) {
                        Severity: Minor
                        Found in lib/includes/Store/Sql/PageTableEntityQueryBase.php - About 1 hr to fix

                          Method newDefinitionsFromConfigArray has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function newDefinitionsFromConfigArray( array $sourceConfig, SubEntityTypesMapper $subEntityTypesMapper ) {
                                  $this->assertConfigArrayWellFormed( $sourceConfig );
                          
                                  $sources = [];
                          
                          
                          Severity: Minor
                          Found in data-access/src/EntitySourceDefinitionsConfigParser.php - About 1 hr to fix

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

                                    option: function ( key, value ) {
                                        if ( key === 'gravity' ) {
                                            // Consider language direction:
                                            value = this._evaluateGravity( value );
                                        }
                            Severity: Major
                            Found in view/resources/jquery/wikibase/jquery.wikibase.wbtooltip.js and 1 other location - About 1 hr to fix
                            client/resources/jquery.wikibase/jquery.wikibase.wbtooltip.js on lines 298..304

                            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 63.

                            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

                                    option: function ( key, value ) {
                                        if ( key === 'gravity' ) {
                                            // Consider language direction:
                                            value = this._evaluateGravity( value );
                                        }
                            view/resources/jquery/wikibase/jquery.wikibase.wbtooltip.js on lines 295..301

                            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 63.

                            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 ( terms.label.getText() === '' ) {
                                                // FIXME: DataModel JavaScript should do this.
                                                value.removeLabelFor( terms.language );
                                            } else {
                                                value.setLabel( terms.language, terms.label );
                            view/resources/jquery/wikibase/jquery.wikibase.entitytermsforlanguagelistview.js on lines 581..586

                            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 63.

                            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 ( terms.description.getText() === '' ) {
                                                // FIXME: DataModel JavaScript should do this.
                                                value.removeDescriptionFor( terms.language );
                                            } else {
                                                value.setDescription( terms.language, terms.description );
                            view/resources/jquery/wikibase/jquery.wikibase.entitytermsforlanguagelistview.js on lines 575..580

                            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 63.

                            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

                                getPageUrl: ( title, params? ) => {
                                    let url = `http://repo/${title}`;
                                    if ( params ) {
                                        url += '?' + new URLSearchParams( params as Record<string, string> ).toString();
                                    }
                            Severity: Major
                            Found in client/data-bridge/src/dev-entry.ts and 1 other location - About 1 hr to fix
                            client/data-bridge/src/dev-entry.ts on lines 134..140

                            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 63.

                            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

                                getPageUrl( title: string, params?: Record<string, unknown> ) {
                                    let url = `https://client.wiki.example/wiki/${title}`;
                                    if ( params ) {
                                        url += '?' + new URLSearchParams( params as Record<string, string> ).toString();
                                    }
                            Severity: Major
                            Found in client/data-bridge/src/dev-entry.ts and 1 other location - About 1 hr to fix
                            client/data-bridge/src/dev-entry.ts on lines 124..130

                            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 63.

                            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

                            Method __construct has 11 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                    EntityContentFactory $contentFactory,
                                    EntityTitleStoreLookup $entityTitleStoreLookup,
                                    IdGenerator $idGenerator,
                                    EntityIdComposer $entityIdComposer,
                                    RevisionStore $revisionStore,
                            Severity: Major
                            Found in repo/includes/Store/Sql/WikiPageEntityStore.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language