wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 2,096 of 2,096 total issues

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

$specialPageAliases['nl'] = [
    'DispatchStats' => [ 'Verwerkingsstatistieken' ],
    'EntityData' => [ 'Entiteitsgegevens' ],
    'GoToLinkedPage' => [ 'NaarGekoppeldePaginaGaan' ],
    'ItemByTitle' => [ 'ItemPerTitel' ],
Severity: Major
Found in repo/Wikibase.i18n.alias.php and 1 other location - About 4 hrs to fix
repo/Wikibase.i18n.alias.php on lines 37..55

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

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

File Resources.php has 344 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare( strict_types = 1 );

use MediaWiki\MediaWikiServices;
Severity: Minor
Found in repo/resources/Resources.php - About 4 hrs to fix

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

    /***/ (function(module, exports, __webpack_require__) {
    
    var global = __webpack_require__("da84");
    var createNonEnumerableProperty = __webpack_require__("9112");
    var has = __webpack_require__("5135");
    Severity: Minor
    Found in view/lib/wikibase-tainted-ref/dist/tainted-ref.common.js - About 4 hrs 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 draw has 106 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            draw: function () {
                var self = this,
                    newValue = this._newDataValue;
    
                function _render() {
    Severity: Major
    Found in view/resources/jquery/wikibase/snakview/snakview.variations.Value.js - About 4 hrs to fix

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

          protected function getBaseRevision() {
              $id = $this->getEntityId();
              try {
                  $baseRev = $this->getEditEntity()->getBaseRevision();
      
      
      Severity: Major
      Found in repo/includes/Specials/SpecialModifyEntity.php and 1 other location - About 4 hrs to fix
      repo/includes/Specials/SpecialModifyEntity.php on lines 134..161

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

      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

          protected function getLatestRevision() {
              $id = $this->getEntityId();
              try {
                  $baseRev = $this->getEditEntity()->getLatestRevision();
      
      
      Severity: Major
      Found in repo/includes/Specials/SpecialModifyEntity.php and 1 other location - About 4 hrs to fix
      repo/includes/Specials/SpecialModifyEntity.php on lines 98..125

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

      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

      File SpecialSetSiteLink.php has 342 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace Wikibase\Repo\Specials;
      
      use InvalidArgumentException;
      Severity: Minor
      Found in repo/includes/Specials/SpecialSetSiteLink.php - About 4 hrs to fix

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

        <?php declare( strict_types=1 );
        
        namespace Wikibase\Repo\RestApi\Application\UseCases\GetSitelinks;
        
        use Wikibase\Repo\RestApi\Application\UseCases\GetLatestItemRevisionMetadata;
        repo/rest-api/src/Application/UseCases/GetItemDescriptions/GetItemDescriptions.php on lines 1..45
        repo/rest-api/src/Application/UseCases/GetItemLabels/GetItemLabels.php on lines 1..45
        repo/rest-api/src/Application/UseCases/GetPropertyAliases/GetPropertyAliases.php on lines 1..44
        repo/rest-api/src/Application/UseCases/GetPropertyDescriptions/GetPropertyDescriptions.php on lines 1..43
        repo/rest-api/src/Application/UseCases/GetPropertyLabels/GetPropertyLabels.php on lines 1..43

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

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

        <?php declare( strict_types = 1 );
        
        namespace Wikibase\Repo\RestApi\Application\UseCases\GetItemLabels;
        
        use Wikibase\Repo\RestApi\Application\UseCases\GetLatestItemRevisionMetadata;
        repo/rest-api/src/Application/UseCases/GetItemDescriptions/GetItemDescriptions.php on lines 1..45
        repo/rest-api/src/Application/UseCases/GetPropertyAliases/GetPropertyAliases.php on lines 1..44
        repo/rest-api/src/Application/UseCases/GetPropertyDescriptions/GetPropertyDescriptions.php on lines 1..43
        repo/rest-api/src/Application/UseCases/GetPropertyLabels/GetPropertyLabels.php on lines 1..43
        repo/rest-api/src/Application/UseCases/GetSitelinks/GetSitelinks.php on lines 1..45

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

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

        <?php declare( strict_types = 1 );
        
        namespace Wikibase\Repo\RestApi\Application\UseCases\GetPropertyAliases;
        
        use Wikibase\Repo\RestApi\Application\UseCases\GetLatestPropertyRevisionMetadata;
        repo/rest-api/src/Application/UseCases/GetItemDescriptions/GetItemDescriptions.php on lines 1..45
        repo/rest-api/src/Application/UseCases/GetItemLabels/GetItemLabels.php on lines 1..45
        repo/rest-api/src/Application/UseCases/GetPropertyDescriptions/GetPropertyDescriptions.php on lines 1..43
        repo/rest-api/src/Application/UseCases/GetPropertyLabels/GetPropertyLabels.php on lines 1..43
        repo/rest-api/src/Application/UseCases/GetSitelinks/GetSitelinks.php on lines 1..45

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

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

        <?php declare( strict_types = 1 );
        
        namespace Wikibase\Repo\RestApi\Application\UseCases\GetPropertyDescriptions;
        
        use Wikibase\Repo\RestApi\Application\UseCases\GetLatestPropertyRevisionMetadata;
        repo/rest-api/src/Application/UseCases/GetItemDescriptions/GetItemDescriptions.php on lines 1..45
        repo/rest-api/src/Application/UseCases/GetItemLabels/GetItemLabels.php on lines 1..45
        repo/rest-api/src/Application/UseCases/GetPropertyAliases/GetPropertyAliases.php on lines 1..44
        repo/rest-api/src/Application/UseCases/GetPropertyLabels/GetPropertyLabels.php on lines 1..43
        repo/rest-api/src/Application/UseCases/GetSitelinks/GetSitelinks.php on lines 1..45

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

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

        <?php declare( strict_types = 1 );
        
        namespace Wikibase\Repo\RestApi\Application\UseCases\GetPropertyLabels;
        
        use Wikibase\Repo\RestApi\Application\UseCases\GetLatestPropertyRevisionMetadata;
        repo/rest-api/src/Application/UseCases/GetItemDescriptions/GetItemDescriptions.php on lines 1..45
        repo/rest-api/src/Application/UseCases/GetItemLabels/GetItemLabels.php on lines 1..45
        repo/rest-api/src/Application/UseCases/GetPropertyAliases/GetPropertyAliases.php on lines 1..44
        repo/rest-api/src/Application/UseCases/GetPropertyDescriptions/GetPropertyDescriptions.php on lines 1..43
        repo/rest-api/src/Application/UseCases/GetSitelinks/GetSitelinks.php on lines 1..45

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

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

        <?php declare( strict_types = 1 );
        
        namespace Wikibase\Repo\RestApi\Application\UseCases\GetItemDescriptions;
        
        use Wikibase\Repo\RestApi\Application\UseCases\GetLatestItemRevisionMetadata;
        repo/rest-api/src/Application/UseCases/GetItemLabels/GetItemLabels.php on lines 1..45
        repo/rest-api/src/Application/UseCases/GetPropertyAliases/GetPropertyAliases.php on lines 1..44
        repo/rest-api/src/Application/UseCases/GetPropertyDescriptions/GetPropertyDescriptions.php on lines 1..43
        repo/rest-api/src/Application/UseCases/GetPropertyLabels/GetPropertyLabels.php on lines 1..43
        repo/rest-api/src/Application/UseCases/GetSitelinks/GetSitelinks.php on lines 1..45

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

        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

        File SpecialNewItem.php has 340 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        declare( strict_types = 1 );
        
        namespace Wikibase\Repo\Specials;
        Severity: Minor
        Found in repo/includes/Specials/SpecialNewItem.php - About 4 hrs to fix

          Method writePropertyPredicates has 104 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function writePropertyPredicates( $localName, $repositoryName, $propertyRdfType, $normalizedPropertyRdfType ) {
                  $this->writer->say( RdfVocabulary::NS_ONTOLOGY, 'directClaim' )->is(
                      $this->vocabulary->propertyNamespaceNames[$repositoryName][RdfVocabulary::NSP_DIRECT_CLAIM],
                      $localName
                  );
          Severity: Major
          Found in repo/includes/Rdf/PropertySpecificComponentsRdfBuilder.php - About 4 hrs to fix

            Method writePropertyPredicates has 104 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function writePropertyPredicates( $localName, $repositoryName, $propertyRdfType, $normalizedPropertyRdfType ) {
                    $this->writer->say( RdfVocabulary::NS_ONTOLOGY, 'directClaim' )->is(
                        $this->vocabulary->propertyNamespaceNames[$repositoryName][RdfVocabulary::NSP_DIRECT_CLAIM],
                        $localName
                    );
            Severity: Major
            Found in repo/includes/Rdf/PropertyStubRdfBuilder.php - About 4 hrs to fix

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

              <?php declare( strict_types=1 );
              
              namespace Wikibase\Repo\RestApi\Domain\Model;
              
              use Wikibase\DataModel\Term\TermList;
              Severity: Major
              Found in repo/rest-api/src/Domain/Model/LabelsEditSummary.php and 2 other locations - About 4 hrs to fix
              repo/rest-api/src/Domain/Model/AliasesEditSummary.php on lines 1..43
              repo/rest-api/src/Domain/Model/DescriptionsEditSummary.php on lines 1..47

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

              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

              <?php declare( strict_types=1 );
              
              namespace Wikibase\Repo\RestApi\Domain\Model;
              
              use Wikibase\DataModel\Term\TermList;
              Severity: Major
              Found in repo/rest-api/src/Domain/Model/DescriptionsEditSummary.php and 2 other locations - About 4 hrs to fix
              repo/rest-api/src/Domain/Model/AliasesEditSummary.php on lines 1..43
              repo/rest-api/src/Domain/Model/LabelsEditSummary.php on lines 1..43

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

              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

              <?php declare( strict_types=1 );
              
              namespace Wikibase\Repo\RestApi\Domain\Model;
              
              use Wikibase\DataModel\Term\AliasGroupList;
              Severity: Major
              Found in repo/rest-api/src/Domain/Model/AliasesEditSummary.php and 2 other locations - About 4 hrs to fix
              repo/rest-api/src/Domain/Model/DescriptionsEditSummary.php on lines 1..47
              repo/rest-api/src/Domain/Model/LabelsEditSummary.php on lines 1..43

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

              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 103 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function __construct(
                      array $conceptUris,
                      array $dataUris,
                      EntitySourceDefinitions $entitySourceDefinitions,
                      array $rdfTurtleNodePrefixes,
              Severity: Major
              Found in repo/includes/Rdf/RdfVocabulary.php - About 4 hrs to fix
                Severity
                Category
                Status
                Source
                Language