wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 2,096 of 2,096 total issues

Method onShowSearchHit has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function onShowSearchHit( $searchPage, $result,
        $terms, &$link, &$redirect, &$section, &$extract, &$score, &$size, &$date, &$related,
        &$html
Severity: Major
Found in repo/includes/Hooks/ShowSearchHitHandler.php - About 1 hr to fix

    Method __construct has 12 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            EntityTitleStoreLookup $titleLookup,
            EntityRevisionLookup $entityLookup,
            EntityStore $entityStore,
            EntityPermissionChecker $permissionChecker,
            EntityDiffer $entityDiffer,
    Severity: Major
    Found in repo/includes/EditEntity/MediaWikiEditEntityFactory.php - About 1 hr to fix

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

                  if ( key === 'value' && !!value ) {
                      if ( !( value instanceof datamodel.StatementGroup ) ) {
                          throw new Error( 'value needs to be a datamodel.StatementGroup instance' );
                      }
                      this.statementlistview.value( value.getItemContainer() );
      view/resources/jquery/wikibase/jquery.wikibase.statementlistview.js on lines 216..221

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                  if ( key === 'value' && !!value ) {
                      if ( !( value instanceof datamodel.StatementList ) ) {
                          throw new Error( 'value needs to be a datamodel.StatementList instance' );
                      }
                      this._listview.value( value.toArray() );
      view/resources/jquery/wikibase/jquery.wikibase.statementgroupview.js on lines 202..207

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                  if ( !this._referencesListview.value().every( function ( referenceview ) {
                      var value = referenceview.value();
                      references.push( value );
                      return value;
                  } ) ) {
      view/resources/jquery/wikibase/jquery.wikibase.snaklistview.js on lines 223..229

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

                  if ( !this._listview.value().every( function ( snakview ) {
                      var snak = snakview.snak();
                      snaks.push( snak );
                      return snak;
                  } ) ) {
      view/resources/jquery/wikibase/jquery.wikibase.statementview.js on lines 557..563

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

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

              _registerTogglerForLanguagelistviewDiv: function ( optionKey ) {
                  var self = this,
                      api = new mw.Api();
                  this.$entitytermsforlanguagelistviewToggler = $( '<div>' )
                      .addClass( 'wikibase-entitytermsview-entitytermsforlanguagelistview-toggler' )
      Severity: Minor
      Found in view/resources/jquery/wikibase/jquery.wikibase.entitytermsview.js - About 1 hr to fix

        Function _appendItem has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                _appendItem: function ( item ) {
                    var self = this;
        
                    var label = this.options.manipulateLabel
                        ? this.options.manipulateLabel( item.getLabel() )
        Severity: Minor
        Found in client/resources/jquery.ui/jquery.ui.ooMenu.js - About 1 hr to fix

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

                  _create: function () {
                      if ( !this.options.getListItemAdapter
                          || ( this.options.value && !( this.options.value instanceof datamodel.StatementList ) )
                      ) {
                          throw new Error( 'Required option not specified properly' );
          Severity: Minor
          Found in view/resources/jquery/wikibase/jquery.wikibase.statementlistview.js - About 1 hr to fix

            Function 6eeb has 37 lines of code (exceeds 25 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 1 hr to fix

              Method rebuildItemTerms has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function rebuildItemTerms( DatabaseUpdater $updater ) {
                      $localEntitySourceName = WikibaseRepo::getSettings()->getSetting( 'localEntitySourceName' );
                      $itemSource = WikibaseRepo::getEntitySourceDefinitions()
                          ->getDatabaseSourceForEntityType( 'item' );
                      if ( $itemSource === null || $itemSource->getSourceName() !== $localEntitySourceName ) {
              Severity: Minor
              Found in repo/includes/Store/Sql/DatabaseSchemaUpdater.php - About 1 hr to fix

                Method getParser has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function getParser(): ValueParser {
                        $params = $this->extractRequestParams();
                
                        $options = $this->getOptionsObject( $params['options'] );
                
                
                Severity: Minor
                Found in repo/includes/Api/ParseValue.php - About 1 hr to fix

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

                      public function execute( $subPage ): void {
                          $this->setHeaders();
                          $this->outputHeader();
                  
                          $this->getOutput()->addWikiMsg( 'wikibase-mylanguagefallbackchain-text' );
                  Severity: Minor
                  Found in repo/includes/Specials/SpecialMyLanguageFallbackChain.php - About 1 hr to fix

                    Method modifyEntity has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function modifyEntity( EntityDocument $entity, ChangeOp $changeOp, array $preparedParameters ): Summary {
                            $data = $preparedParameters[self::PARAM_DATA];
                    
                            $exists = $this->entityExists( $entity->getId() );
                    
                    
                    Severity: Minor
                    Found in repo/includes/Api/EditEntity.php - About 1 hr to fix

                      Method onShowSearchHit has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function onShowSearchHit( $searchPage, $result,
                              $terms, &$link, &$redirect, &$section, &$extract, &$score, &$size, &$date, &$related,
                              &$html
                          ): void {
                              if ( $result instanceof ExtendedResult ) {
                      Severity: Minor
                      Found in repo/includes/Hooks/ShowSearchHitHandler.php - About 1 hr to fix

                        Method newPlaceHolderEmittingEntityTermsView has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function newPlaceHolderEmittingEntityTermsView(
                                EntityDocument $entity,
                                Language $language,
                                TermLanguageFallbackChain $termFallbackChain
                            ) {
                        Severity: Minor
                        Found in repo/includes/ParserOutput/EntityTermsViewFactory.php - About 1 hr to fix

                          Method __construct has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function __construct() {
                                  parent::__construct();
                          
                                  $this->addDescription( 'Generate a ' . $this->getDumpType() . ' dump from entities in the repository.' );
                          
                          
                          Severity: Minor
                          Found in repo/maintenance/DumpEntities.php - About 1 hr to fix

                            Method throwUseCaseError has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function throwUseCaseError( ValidationError $validationError ): void {
                                    $context = $validationError->getContext();
                                    switch ( $validationError->getCode() ) {
                                        case LanguageCodeValidator::CODE_INVALID_LANGUAGE_CODE:
                                            throw UseCaseError::newPatchResultInvalidKey( '', $context[LanguageCodeValidator::CONTEXT_LANGUAGE_CODE] );

                              Method findActuallyUnusedTermInLangIds has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private function findActuallyUnusedTermInLangIds( array $termInLangIds, IDatabase $dbw ) {
                                      $unusedTermInLangIds = [];
                                      foreach ( $termInLangIds as $termInLangId ) {
                                          // Note: Not batching here is intentional to avoid deadlocks (see method comment)
                                          $usedInProperties = $dbw->newSelectQueryBuilder()
                              Severity: Minor
                              Found in lib/includes/Store/Sql/Terms/FindUnusedTermTrait.php - About 1 hr to fix

                                Function validateBridgeApplicability has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public validateBridgeApplicability(
                                        path: MainSnakPath,
                                    ): Promise<unknown> {
                                        if ( this.state.applicationStatus === ApplicationStatus.SAVED ) {
                                            // saving edits can transition us from applicable to inapplicable states, but that should not be an error
                                Severity: Minor
                                Found in client/data-bridge/src/store/actions.ts - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language