wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 2,096 of 2,096 total issues

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

    public function __construct(
        AnonymousEditWarningBuilder $anonymousEditWarningBuilder,
        EntityIdParser $idParser,
        ExceptionLocalizer $exceptionLocalizer,
        ItemRedirectCreationInteractor $interactor,
Severity: Major
Found in repo/includes/Specials/SpecialRedirectEntity.php and 2 other locations - About 40 mins to fix
repo/includes/Specials/SpecialGoToLinkedPage.php on lines 64..78
repo/includes/Specials/SpecialListProperties.php on lines 66..80

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

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 function onEnhancedChangesListModifyBlockLineData(
        $changesList,
        &$data,
        $rc
    ): void {
Severity: Minor
Found in client/includes/Hooks/ChangesListLinesHandler.php and 1 other location - About 40 mins to fix
client/includes/Hooks/ChangesListLinesHandler.php on lines 150..175

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

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 function __construct(
        StatementGroupRendererFactory $rendererFactory,
        SiteLinkLookup $siteLinkLookup,
        EntityIdParser $entityIdParser,
        RestrictedEntityLookup $restrictedEntityLookup,
Severity: Minor
Found in client/includes/DataAccess/ParserFunctions/Runner.php and 1 other location - About 40 mins to fix
client/includes/Hooks/LangLinkHandler.php on lines 62..76

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

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 function __construct(
        LanguageLinkBadgeDisplay $badgeDisplay,
        NamespaceChecker $namespaceChecker,
        SiteLinksForDisplayLookup $siteLinkForDisplayLookup,
        SiteLookup $siteLookup,
Severity: Minor
Found in client/includes/Hooks/LangLinkHandler.php and 1 other location - About 40 mins to fix
client/includes/DataAccess/ParserFunctions/Runner.php on lines 61..75

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

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 function onEnhancedChangesListModifyLineData(
        $changesList,
        &$data,
        $block,
        $rc,
Severity: Minor
Found in client/includes/Hooks/ChangesListLinesHandler.php and 1 other location - About 40 mins to fix
client/includes/Hooks/ChangesListLinesHandler.php on lines 118..140

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 94.

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

Consider simplifying this complex logical expression.
Open

        if (
            !editEntityResponse.entity ||
            !editEntityResponse.entity.id ||
            !editEntityResponse.entity.labels ||
            !editEntityResponse.entity.descriptions ||
Severity: Major
Found in view/resources/wikibase/termbox/RepoApiWritingEntityRepository.js - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

            if ( ( $year == 0 && $precision < TimeValue::PRECISION_YEAR )
                || ( $month == 0 && $precision >= TimeValue::PRECISION_MONTH )
                || ( $day == 0 && $precision >= TimeValue::PRECISION_DAY )
            ) {
                throw new InvalidArgumentException( 'Time value insufficient for precision.' );
    Severity: Major
    Found in lib/includes/Formatters/MwTimeIsoFormatter.php - About 40 mins to fix

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

              _toEditMode: function () {
                  this.getContainer().removeClass( this.widgetBaseClass + '-ineditmode' );
                  this.toEditMode();
              },
      view/resources/jquery/wikibase/toolbar/jquery.wikibase.edittoolbar.js on lines 295..298

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

      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 ( value.datavalue instanceof dv.DataValue ) {
                      value.datavalue = {
                          type: value.datavalue.getType(),
                          value: value.datavalue.toJSON()
                      };
      Severity: Minor
      Found in view/resources/jquery/wikibase/snakview/snakview.js and 1 other location - About 40 mins to fix
      view/resources/jquery/wikibase/snakview/snakview.js on lines 577..582

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

      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 ( variationValue.datavalue ) {
                          variationValue.datavalue = {
                              type: variationValue.datavalue.getType(),
                              value: variationValue.datavalue.toJSON()
                          };
      Severity: Minor
      Found in view/resources/jquery/wikibase/snakview/snakview.js and 1 other location - About 40 mins to fix
      view/resources/jquery/wikibase/snakview/snakview.js on lines 482..487

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

      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

              _toNonEditMode: function () {
                  this.getContainer().addClass( this.widgetBaseClass + '-ineditmode' );
                  this.toNonEditMode();
              },
      view/resources/jquery/wikibase/toolbar/jquery.wikibase.edittoolbar.js on lines 262..265

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

      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 function formatStatements( string $entityId, string $propertyLabelOrId, array $acceptableRanks = null ): array {
              try {
                  return [
                      $this->getImplementation()->formatStatements(
                          $entityId,
      Severity: Minor
      Found in client/includes/DataAccess/Scribunto/WikibaseEntityLibrary.php and 1 other location - About 40 mins to fix
      client/includes/DataAccess/Scribunto/WikibaseEntityLibrary.php on lines 256..273

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

      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 function formatPropertyValues( string $entityId, string $propertyLabelOrId, array $acceptableRanks = null ): array {
              try {
                  return [
                      $this->getImplementation()->formatPropertyValues(
                          $entityId,
      Severity: Minor
      Found in client/includes/DataAccess/Scribunto/WikibaseEntityLibrary.php and 1 other location - About 40 mins to fix
      client/includes/DataAccess/Scribunto/WikibaseEntityLibrary.php on lines 286..303

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

      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

                  return new CombinedEntitySearchHelper(
                          [
                              new EntityIdSearchHelper(
                                  WikibaseRepo::getEntityLookup(),
                                  WikibaseRepo::getEntityIdParser(),
      Severity: Minor
      Found in repo/WikibaseRepo.entitytypes.php and 1 other location - About 40 mins to fix
      repo/WikibaseRepo.entitytypes.php on lines 427..446

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

      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

                      new CombinedEntitySearchHelper(
                          [
                              new EntityIdSearchHelper(
                                  WikibaseRepo::getEntityLookup(),
                                  WikibaseRepo::getEntityIdParser(),
      Severity: Minor
      Found in repo/WikibaseRepo.entitytypes.php and 1 other location - About 40 mins to fix
      repo/WikibaseRepo.entitytypes.php on lines 224..242

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

      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 PageConnector has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              repoApi,
              firstSiteId,
              firstPageName,
              secondSiteId,
              secondPageName
      Severity: Minor
      Found in client/resources/wikibase.client.PageConnector.js - About 35 mins to fix

        Function SELF has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                viewState,
                $viewPort,
                propertyDataTypeStore,
                valueViewBuilder,
                dataTypeStore
        Severity: Minor
        Found in view/resources/jquery/wikibase/snakview/snakview.variations.Variation.js - About 35 mins to fix

          Function getSiteLinkListView has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              SELF.prototype.getSiteLinkListView = function ( startEditingCallback, siteLinks, $sitelinklistview, allowedSiteIds, $counter ) {
          Severity: Minor
          Found in view/resources/wikibase/view/ViewFactory.js - About 35 mins to fix

            Function _attach has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    _attach: function ( source, target, event, handler, options ) {
            Severity: Minor
            Found in view/resources/jquery/jquery.util.EventSingletonManager.js - About 35 mins to fix

              Function makeAssertionMessage has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              function makeAssertionMessage (path, key, type, value, expected) {
              Severity: Minor
              Found in view/lib/wikibase-tainted-ref/dist/tainted-ref.common.js - About 35 mins to fix
                Severity
                Category
                Status
                Source
                Language