wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 2,096 of 2,096 total issues

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

<?php declare( strict_types = 1 );

namespace Wikibase\Repo\RestApi\Application\UseCases\RemoveSitelink;

use Wikibase\Repo\RestApi\Application\UseCaseRequestValidation\EditMetadataRequest;
repo/rest-api/src/Application/UseCases/AddItemStatement/AddItemStatementRequest.php on lines 1..54
repo/rest-api/src/Application/UseCases/AddPropertyStatement/AddPropertyStatementRequest.php on lines 1..55
repo/rest-api/src/Application/UseCases/PatchItem/PatchItemRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchItemAliases/PatchItemAliasesRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchItemDescriptions/PatchItemDescriptionsRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchItemLabels/PatchItemLabelsRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchProperty/PatchPropertyRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchPropertyAliases/PatchPropertyAliasesRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchPropertyDescriptions/PatchPropertyDescriptionsRequest.php on lines 1..61
repo/rest-api/src/Application/UseCases/PatchPropertyLabels/PatchPropertyLabelsRequest.php on lines 1..61
repo/rest-api/src/Application/UseCases/PatchSitelinks/PatchSitelinksRequest.php on lines 1..61
repo/rest-api/src/Application/UseCases/PatchStatement/PatchStatementRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/RemoveItemDescription/RemoveItemDescriptionRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/RemoveItemLabel/RemoveItemLabelRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/RemovePropertyDescription/RemovePropertyDescriptionRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/RemovePropertyLabel/RemovePropertyLabelRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/ReplaceStatement/ReplaceStatementRequest.php on lines 1..62

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

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

<?php declare( strict_types=1 );

namespace Wikibase\Repo\RestApi\Application\UseCases\PatchProperty;

use Wikibase\Repo\RestApi\Application\UseCaseRequestValidation\EditMetadataRequest;
repo/rest-api/src/Application/UseCases/AddItemStatement/AddItemStatementRequest.php on lines 1..54
repo/rest-api/src/Application/UseCases/AddPropertyStatement/AddPropertyStatementRequest.php on lines 1..55
repo/rest-api/src/Application/UseCases/PatchItem/PatchItemRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchItemAliases/PatchItemAliasesRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchItemDescriptions/PatchItemDescriptionsRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchItemLabels/PatchItemLabelsRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchPropertyAliases/PatchPropertyAliasesRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchPropertyDescriptions/PatchPropertyDescriptionsRequest.php on lines 1..61
repo/rest-api/src/Application/UseCases/PatchPropertyLabels/PatchPropertyLabelsRequest.php on lines 1..61
repo/rest-api/src/Application/UseCases/PatchSitelinks/PatchSitelinksRequest.php on lines 1..61
repo/rest-api/src/Application/UseCases/PatchStatement/PatchStatementRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/RemoveItemDescription/RemoveItemDescriptionRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/RemoveItemLabel/RemoveItemLabelRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/RemovePropertyDescription/RemovePropertyDescriptionRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/RemovePropertyLabel/RemovePropertyLabelRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/RemoveSitelink/RemoveSitelinkRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/ReplaceStatement/ReplaceStatementRequest.php on lines 1..62

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

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

<?php declare( strict_types=1 );

namespace Wikibase\Repo\RestApi\Application\UseCases\PatchItemAliases;

use Wikibase\Repo\RestApi\Application\UseCaseRequestValidation\EditMetadataRequest;
repo/rest-api/src/Application/UseCases/AddItemStatement/AddItemStatementRequest.php on lines 1..54
repo/rest-api/src/Application/UseCases/AddPropertyStatement/AddPropertyStatementRequest.php on lines 1..55
repo/rest-api/src/Application/UseCases/PatchItem/PatchItemRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchItemDescriptions/PatchItemDescriptionsRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchItemLabels/PatchItemLabelsRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchProperty/PatchPropertyRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchPropertyAliases/PatchPropertyAliasesRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchPropertyDescriptions/PatchPropertyDescriptionsRequest.php on lines 1..61
repo/rest-api/src/Application/UseCases/PatchPropertyLabels/PatchPropertyLabelsRequest.php on lines 1..61
repo/rest-api/src/Application/UseCases/PatchSitelinks/PatchSitelinksRequest.php on lines 1..61
repo/rest-api/src/Application/UseCases/PatchStatement/PatchStatementRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/RemoveItemDescription/RemoveItemDescriptionRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/RemoveItemLabel/RemoveItemLabelRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/RemovePropertyDescription/RemovePropertyDescriptionRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/RemovePropertyLabel/RemovePropertyLabelRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/RemoveSitelink/RemoveSitelinkRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/ReplaceStatement/ReplaceStatementRequest.php on lines 1..62

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

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

<?php declare( strict_types=1 );

namespace Wikibase\Repo\RestApi\Application\UseCases\AddItemStatement;

use Wikibase\Repo\RestApi\Application\UseCaseRequestValidation\EditMetadataRequest;
repo/rest-api/src/Application/UseCases/AddPropertyStatement/AddPropertyStatementRequest.php on lines 1..55
repo/rest-api/src/Application/UseCases/PatchItem/PatchItemRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchItemAliases/PatchItemAliasesRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchItemDescriptions/PatchItemDescriptionsRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchItemLabels/PatchItemLabelsRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchProperty/PatchPropertyRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchPropertyAliases/PatchPropertyAliasesRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/PatchPropertyDescriptions/PatchPropertyDescriptionsRequest.php on lines 1..61
repo/rest-api/src/Application/UseCases/PatchPropertyLabels/PatchPropertyLabelsRequest.php on lines 1..61
repo/rest-api/src/Application/UseCases/PatchSitelinks/PatchSitelinksRequest.php on lines 1..61
repo/rest-api/src/Application/UseCases/PatchStatement/PatchStatementRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/RemoveItemDescription/RemoveItemDescriptionRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/RemoveItemLabel/RemoveItemLabelRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/RemovePropertyDescription/RemovePropertyDescriptionRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/RemovePropertyLabel/RemovePropertyLabelRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/RemoveSitelink/RemoveSitelinkRequest.php on lines 1..62
repo/rest-api/src/Application/UseCases/ReplaceStatement/ReplaceStatementRequest.php on lines 1..62

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

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

        _considerSuggestion: function ( site ) {
            var check = [
                site.getId(),
                site.getShortName(),
                site.getName(),
view/resources/jquery/wikibase/jquery.wikibase.siteselector.js on lines 245..260

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

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

        _considerSuggestion: function ( site ) {
            var check = [
                site.getId(),
                site.getShortName(),
                site.getName(),
client/resources/jquery.wikibase/jquery.wikibase.siteselector.js on lines 248..263

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

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

    public static function factory(
        ApiMain $mainModule,
        string $moduleName,
        ApiHelperFactory $apiHelperFactory,
        ChangeOpFactoryProvider $changeOpFactoryProvider,
Severity: Major
Found in repo/includes/Api/RemoveReferences.php and 3 other locations - About 5 hrs to fix
repo/includes/Api/RemoveClaims.php on lines 98..132
repo/includes/Api/RemoveQualifiers.php on lines 95..129
repo/includes/Api/SetClaimValue.php on lines 90..124

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

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

    public static function factory(
        ApiMain $mainModule,
        string $moduleName,
        ApiHelperFactory $apiHelperFactory,
        ChangeOpFactoryProvider $changeOpFactoryProvider,
Severity: Major
Found in repo/includes/Api/RemoveClaims.php and 3 other locations - About 5 hrs to fix
repo/includes/Api/RemoveQualifiers.php on lines 95..129
repo/includes/Api/RemoveReferences.php on lines 94..128
repo/includes/Api/SetClaimValue.php on lines 90..124

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

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

    public static function factory(
        ApiMain $mainModule,
        string $moduleName,
        ApiHelperFactory $apiHelperFactory,
        ChangeOpFactoryProvider $changeOpFactoryProvider,
Severity: Major
Found in repo/includes/Api/RemoveQualifiers.php and 3 other locations - About 5 hrs to fix
repo/includes/Api/RemoveClaims.php on lines 98..132
repo/includes/Api/RemoveReferences.php on lines 94..128
repo/includes/Api/SetClaimValue.php on lines 90..124

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

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

        'PT:wikibase-item' => [
            'expert-module' => 'wikibase.experts.Item',
            'validator-factory-callback' => function() {
                $factory = WikibaseRepo::getDefaultValidatorBuilders();
                return $factory->buildItemValidators();
Severity: Major
Found in repo/WikibaseRepo.datatypes.php and 1 other location - About 5 hrs to fix
repo/WikibaseRepo.datatypes.php on lines 457..488

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

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

        'PT:wikibase-property' => [
            'expert-module' => 'wikibase.experts.Property',
            'validator-factory-callback' => function() {
                $factory = WikibaseRepo::getDefaultValidatorBuilders();
                return $factory->buildPropertyValidators();
Severity: Major
Found in repo/WikibaseRepo.datatypes.php and 1 other location - About 5 hrs to fix
repo/WikibaseRepo.datatypes.php on lines 425..456

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

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

    public static function factory(
        ApiMain $mainModule,
        string $moduleName,
        ApiHelperFactory $apiHelperFactory,
        ChangeOpFactoryProvider $changeOpFactoryProvider,
Severity: Major
Found in repo/includes/Api/SetClaimValue.php and 3 other locations - About 5 hrs to fix
repo/includes/Api/RemoveClaims.php on lines 98..132
repo/includes/Api/RemoveQualifiers.php on lines 95..129
repo/includes/Api/RemoveReferences.php on lines 94..128

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

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 jquery.wikibase.linkitem.js has 396 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * @license GPL-2.0-or-later
 * @author Marius Hoch < hoo@online.de >
 */
( function ( wb ) {
Severity: Minor
Found in client/resources/jquery.wikibase/jquery.wikibase.linkitem.js - About 5 hrs to fix

    File EditEntity.php has 395 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

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

      <?php declare( strict_types=1 );
      
      namespace Wikibase\Repo\RestApi\Domain\Model;
      
      use Wikibase\DataModel\Entity\Item;
      Severity: Major
      Found in repo/rest-api/src/Domain/Model/PatchItemEditSummary.php and 1 other location - About 5 hrs to fix
      repo/rest-api/src/Domain/Model/PatchPropertyEditSummary.php on lines 1..44

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

      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

      <?php declare( strict_types=1 );
      
      namespace Wikibase\Repo\RestApi\Domain\Model;
      
      use Wikibase\DataModel\Entity\Property;
      Severity: Major
      Found in repo/rest-api/src/Domain/Model/PatchPropertyEditSummary.php and 1 other location - About 5 hrs to fix
      repo/rest-api/src/Domain/Model/PatchItemEditSummary.php on lines 1..44

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

      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 setTermsFromSerialization( array $serialization, Property $property ) {
              if ( array_key_exists( 'labels', $serialization ) ) {
                  $this->assertAttributeIsArray( $serialization, 'labels' );
                  /** @var TermList $labels */
                  $labels = $this->termListDeserializer->deserialize( $serialization['labels'] );
      lib/packages/wikibase/data-model-serialization/src/Deserializers/ItemDeserializer.php on lines 101..122

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

      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 setTermsFromSerialization( array $serialization, Item $item ) {
              if ( array_key_exists( 'labels', $serialization ) ) {
                  $this->assertAttributeIsArray( $serialization, 'labels' );
                  /** @var TermList $labels */
                  $labels = $this->termListDeserializer->deserialize( $serialization['labels'] );
      lib/packages/wikibase/data-model-serialization/src/Deserializers/PropertyDeserializer.php on lines 99..120

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

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

      function addDevtools (app, store) {
        Object(esm["setupDevtoolsPlugin"])(
          {
            id: 'org.vuejs.vuex',
            app: app,
      Severity: Major
      Found in view/lib/wikibase-tainted-ref/dist/tainted-ref.common.js - About 5 hrs to fix

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

            public function loadLatestRevisionIds( array $entityIds, $mode ): array {
                $revisionIds = [];
        
                $this->assertCanHandleEntityIds( $entityIds );
        
        
        Severity: Major
        Found in lib/includes/Store/Sql/WikiPageEntityMetaDataLookup.php and 1 other location - About 5 hrs to fix
        lib/includes/Store/Sql/WikiPageEntityMetaDataLookup.php on lines 69..99

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

        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