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

    public static function factory(): self {
        return new GetSitelinkRouteHandler(
            WbRestApi::getGetSitelink(),
            new SitelinkSerializer(),
            new MiddlewareHandler( [
Severity: Major
Found in repo/rest-api/src/RouteHandlers/GetSitelinkRouteHandler.php and 1 other location - About 1 hr to fix
repo/rest-api/src/RouteHandlers/GetPropertyAliasesRouteHandler.php on lines 46..60

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

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\Application\Serialization\Exceptions;

use Throwable;
repo/rest-api/src/Application/Serialization/Exceptions/MissingFieldException.php on lines 1..29

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

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\Application\UseCaseRequestValidation;

use Wikibase\Repo\RestApi\Application\UseCases\UseCaseError;
repo/rest-api/src/Application/UseCaseRequestValidation/SiteIdRequestValidatingDeserializer.php on lines 1..34

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

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

    public static function factory(): self {
        $responseFactory = new ResponseFactory();
        return new self(
            WbRestApi::getGetPropertyLabel(),
            new MiddlewareHandler( [
repo/rest-api/src/RouteHandlers/GetPropertyLabelWithFallbackRouteHandler.php on lines 44..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 110.

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

    public static function factory(): self {
        $responseFactory = new ResponseFactory();
        return new self(
            WbRestApi::getGetPropertyLabelWithFallback(),
            new MiddlewareHandler( [
repo/rest-api/src/RouteHandlers/GetPropertyLabelRouteHandler.php on lines 45..59

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

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

    public static function factory(): self {
        return new self(
            WbRestApi::getGetPropertyAliases(),
            new AliasesSerializer(),
            new MiddlewareHandler( [
repo/rest-api/src/RouteHandlers/GetSitelinkRouteHandler.php on lines 36..50

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

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

        'mw.config.values.wbSiteDetails' => $moduleTemplate + [
            'factory' => function () {
                return new SitesModule(
                    WikibaseSettings::isClientEnabled() ? WikibaseClient::getSettings() : null,
                    WikibaseSettings::isRepoEnabled() ? WikibaseRepo::getSettings() : null,
Severity: Major
Found in lib/resources/Resources.php and 1 other location - About 1 hr to fix
lib/resources/Resources.php on lines 28..41

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

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\Application\Serialization\Exceptions;

use Throwable;
repo/rest-api/src/Application/Serialization/Exceptions/PropertyNotFoundException.php on lines 1..28

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

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

        'mw.config.values.wbCurrentSiteDetails' => $moduleTemplate + [
            'factory' => function () {
                return new CurrentSiteModule(
                    WikibaseSettings::isClientEnabled() ? WikibaseClient::getSettings() : null,
                    WikibaseSettings::isRepoEnabled() ? WikibaseRepo::getSettings() : null,
Severity: Major
Found in lib/resources/Resources.php and 1 other location - About 1 hr to fix
lib/resources/Resources.php on lines 43..56

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

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\Application\UseCaseRequestValidation;

use Wikibase\Repo\RestApi\Application\UseCases\UseCaseError;
repo/rest-api/src/Application/UseCaseRequestValidation/LanguageCodeRequestValidatingDeserializer.php on lines 1..34

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

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

export interface MwWindowOO {
    ui: {
        Dialog: DialogConstructor;
        PanelLayout: PanelLayoutConstructor;
        WindowManager: WindowManagerConstructor;
Severity: Major
Found in client/data-bridge/src/@types/mediawiki/MwWindow.ts and 1 other location - About 1 hr to fix
view/lib/wikibase-tainted-ref/src/@types/mediawiki/MwWindow.ts on lines 102..109

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

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

export interface MwWindowOO {
    ui: {
        Dialog: DialogConstructor;
        PanelLayout: PanelLayoutConstructor;
        WindowManager: WindowManagerConstructor;
client/data-bridge/src/@types/mediawiki/MwWindow.ts on lines 135..142

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

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

        _setOption: function ( key, value ) {
            if ( key === 'value' ) {
                if ( value !== null
                    && !$.isPlainObject( value )
                    && !( value instanceof datamodel.Snak )
Severity: Minor
Found in view/resources/jquery/wikibase/snakview/snakview.js - About 1 hr to fix

    Function _onMulPulsatingDotClicked has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            _onMulPulsatingDotClicked: function ( _event ) {
                if ( !this._popup ) {
                    var $target = $( this.element ).find( '.mw-pulsating-dot-popup-container' );
    
                    var dontShowMulPopupCheckbox = new OO.ui.CheckboxInputWidget( {

      Function _create has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              _create: function () {
                  var self = this;
      
                  this._cache = {};
      
      
      Severity: Minor
      Found in view/resources/jquery/wikibase/jquery.wikibase.entityselector.js - About 1 hr to fix

        Method register has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function register() {
                // These functions will be exposed to the Lua module.
                // They are member functions on a Lua table which is private to the module, thus
                // these can't be called from user code, unless explicitly exposed in Lua.
                $lib = [
        Severity: Minor
        Found in client/includes/DataAccess/Scribunto/WikibaseLibrary.php - About 1 hr to fix

          Function 23e7 has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          /***/ (function(module, exports, __webpack_require__) {
          
          var global = __webpack_require__("da84");
          var getOwnPropertyDescriptor = __webpack_require__("06cf").f;
          var createNonEnumerableProperty = __webpack_require__("9112");
          Severity: Minor
          Found in view/lib/wikibase-tainted-ref/dist/tainted-ref.common.js - About 1 hr to fix

            Method buildTermSearchMatchPageEntry has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function buildTermSearchMatchPageEntry( TermSearchResult $match, ?array $props ): array {
                    $entityId = $match->getEntityId();
                    if ( $entityId !== null ) {
                        $entry = [
                            'id' => $entityId->getSerialization(),
            Severity: Minor
            Found in repo/includes/Api/SearchEntities.php - About 1 hr to fix

              Method validateEntitySpecificParameters has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function validateEntitySpecificParameters(
                      array $preparedParameters,
                      EntityDocument $entity,
                      int $baseRevId
                  ): void {
              Severity: Minor
              Found in repo/includes/Api/EditEntity.php - About 1 hr to fix

                Method resolveMentionedEntities has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function resolveMentionedEntities(): void {
                        $hasRedirect = false;
                
                        $this->markStubEntityDataForPrefetching( $this->entitiesResolved );
                
                
                Severity: Minor
                Found in repo/includes/Rdf/RdfBuilder.php - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language