wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 2,096 of 2,096 total issues

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

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

    Method onPageHistoryLineEnding has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function onPageHistoryLineEnding( HistoryPager $history, $row, &$html, array $classes ) {
            // Note: This assumes that HistoryPager::getTitle returns a Title.
            $entityContentFactory = WikibaseRepo::getEntityContentFactory();
            $services = MediaWikiServices::getInstance();
    
    
    Severity: Minor
    Found in repo/includes/RepoHooks.php - About 1 hr to fix

      Method httpContentNegotiation has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function httpContentNegotiation( WebRequest $request, OutputPage $output, EntityId $id, $revision = 0 ) {
              $headers = $request->getAllHeaders();
              if ( isset( $headers['ACCEPT'] ) ) {
                  $parser = new HttpAcceptParser();
                  $accept = $parser->parseWeights( $headers['ACCEPT'] );
      Severity: Minor
      Found in repo/includes/LinkedData/EntityDataRequestHandler.php - About 1 hr to fix

        Method cleanupGregorianValue has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function cleanupGregorianValue( $dateValue, $precision ) {
                try {
                    [ $minus, $y, $m, $d, $time ] = $this->parseDateValue( $dateValue );
                } catch ( IllegalValueException $e ) {
                    return null;
        Severity: Minor
        Found in repo/includes/Rdf/DateTimeValueCleaner.php - About 1 hr to fix

          Method newEditEntity has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function newEditEntity(
                  IContextSource $context,
                  EntityId $entityId = null,
                  int $baseRevId = 0,
                  $allowMasterConnection = true
          Severity: Minor
          Found in repo/includes/EditEntity/MediaWikiEditEntityFactory.php - About 1 hr to fix

            Method execute has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function execute() {
                    if ( !WikibaseSettings::isRepoEnabled() ) {
                        $this->fatalError( "You need to have Wikibase enabled in order to use this maintenance script!\n" );
                    }
                    if ( !in_array( Property::ENTITY_TYPE, WikibaseRepo::getLocalEntitySource()->getEntityTypes() ) ) {
            Severity: Minor
            Found in repo/maintenance/changePropertyDataType.php - About 1 hr to fix

              Method execute has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function execute( PatchSitelinksRequest $request ): PatchSitelinksResponse {
                      $deserializedRequest = $this->useCaseValidator->validateAndDeserialize( $request );
                      $itemId = $deserializedRequest->getItemId();
              
                      $this->assertItemExists->execute( $itemId );

                Method newItemView has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function newItemView(
                        Language $language,
                        TermLanguageFallbackChain $termFallbackChain,
                        CacheableEntityTermsView $entityTermsView
                    ) {
                Severity: Minor
                Found in view/src/ViewFactory.php - About 1 hr to fix

                  Method prefetchTerms has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function prefetchTerms(
                          array $entityIds,
                          array $termTypes,
                          array $languageCodes
                      ) {
                  Severity: Minor
                  Found in lib/includes/Store/Sql/Terms/PrefetchingEntityTermLookupBase.php - About 1 hr to fix

                    Method resolveGroupedTermInLangIds has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function resolveGroupedTermInLangIds(
                            array $groupedTermInLangIds,
                            array $types = null,
                            array $languages = null
                        ): array {
                    Severity: Minor
                    Found in lib/includes/Store/Sql/Terms/DatabaseTermInLangIdsResolver.php - About 1 hr to fix

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

                                  if ( key === 'disabled' ) {
                                      this.listview.option( key, value );
                                      if ( this._statementGroupAdder ) {
                                          this._statementGroupAdder[ value ? 'disable' : 'enable' ]();
                                      }
                      view/resources/jquery/wikibase/jquery.wikibase.statementlistview.js on lines 225..230

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

                      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.options.getListItemAdapter
                                      || ( this.options.value && !( this.options.value instanceof datamodel.StatementList ) )
                                  ) {
                                      throw new Error( 'Required option not specified properly' );
                                  }
                      view/resources/jquery/wikibase/jquery.wikibase.statementgrouplistview.js on lines 54..58

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

                      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.options.listItemAdapter
                                      || ( this.options.value && !( this.options.value instanceof datamodel.StatementGroupSet ) )
                                  ) {
                                      throw new Error( 'Required option not specified properly' );
                                  }
                      view/resources/jquery/wikibase/jquery.wikibase.statementlistview.js on lines 85..89

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

                      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 ( key === 'disabled' ) {
                                      this._listview.option( key, value );
                                      if ( this._statementAdder ) {
                                          this._statementAdder[ value ? 'disable' : 'enable' ]();
                                      }
                      view/resources/jquery/wikibase/jquery.wikibase.statementgrouplistview.js on lines 215..220

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

                      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 3 locations. Consider refactoring.
                      Open

                          [ SET_ALL_EDIT_MODE_FALSE ](
                              state: Application,
                              guids: string[],
                          ): void {
                              guids.forEach( ( guid ) => {
                      Severity: Major
                      Found in view/lib/wikibase-tainted-ref/src/store/mutations.ts and 2 other locations - About 1 hr to fix
                      view/lib/wikibase-tainted-ref/src/store/mutations.ts on lines 17..24
                      view/lib/wikibase-tainted-ref/src/store/mutations.ts on lines 25..32

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

                      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 3 locations. Consider refactoring.
                      Open

                          [ SET_ALL_POPPERS_HIDDEN ](
                              state: Application,
                              guids: string[],
                          ): void {
                              guids.forEach( ( guid ) => {
                      Severity: Major
                      Found in view/lib/wikibase-tainted-ref/src/store/mutations.ts and 2 other locations - About 1 hr to fix
                      view/lib/wikibase-tainted-ref/src/store/mutations.ts on lines 17..24
                      view/lib/wikibase-tainted-ref/src/store/mutations.ts on lines 33..40

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

                      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 3 locations. Consider refactoring.
                      Open

                          [ SET_ALL_UNTAINTED ](
                              state: Application,
                              guids: string[],
                          ): void {
                              guids.forEach( ( guid ) => {
                      Severity: Major
                      Found in view/lib/wikibase-tainted-ref/src/store/mutations.ts and 2 other locations - About 1 hr to fix
                      view/lib/wikibase-tainted-ref/src/store/mutations.ts on lines 25..32
                      view/lib/wikibase-tainted-ref/src/store/mutations.ts on lines 33..40

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

                      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 4 locations. Consider refactoring.
                      Open

                      <?php declare( strict_types=1 );
                      
                      namespace Wikibase\Repo\RestApi\Application\UseCases\PatchPropertyStatement;
                      
                      use Wikibase\Repo\RestApi\Application\UseCaseRequestValidation\PropertyStatementIdRequest;
                      repo/rest-api/src/Application/UseCases/PatchItemStatement/PatchItemStatementRequest.php on lines 1..32
                      repo/rest-api/src/Application/UseCases/ReplaceItemStatement/ReplaceItemStatementRequest.php on lines 1..31
                      repo/rest-api/src/Application/UseCases/ReplacePropertyStatement/ReplacePropertyStatementRequest.php on lines 1..31

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

                      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 4 locations. Consider refactoring.
                      Open

                      <?php declare( strict_types=1 );
                      
                      namespace Wikibase\Repo\RestApi\Application\UseCases\ReplacePropertyStatement;
                      
                      use Wikibase\Repo\RestApi\Application\UseCaseRequestValidation\PropertyStatementIdRequest;
                      repo/rest-api/src/Application/UseCases/PatchItemStatement/PatchItemStatementRequest.php on lines 1..32
                      repo/rest-api/src/Application/UseCases/PatchPropertyStatement/PatchPropertyStatementRequest.php on lines 1..32
                      repo/rest-api/src/Application/UseCases/ReplaceItemStatement/ReplaceItemStatementRequest.php on lines 1..31

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

                      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 4 locations. Consider refactoring.
                      Open

                      <?php declare( strict_types=1 );
                      
                      namespace Wikibase\Repo\RestApi\Application\UseCases\ReplaceItemStatement;
                      
                      use Wikibase\Repo\RestApi\Application\UseCaseRequestValidation\ItemStatementIdRequest;
                      repo/rest-api/src/Application/UseCases/PatchItemStatement/PatchItemStatementRequest.php on lines 1..32
                      repo/rest-api/src/Application/UseCases/PatchPropertyStatement/PatchPropertyStatementRequest.php on lines 1..32
                      repo/rest-api/src/Application/UseCases/ReplacePropertyStatement/ReplacePropertyStatementRequest.php on lines 1..31

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language