wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 2,096 of 2,096 total issues

Function initLinkItem has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function initLinkItem( elem ) {
        var $spinner = $.createSpinner(),
            $linkItemLink = $( elem );

        $linkItemLink
Severity: Minor
Found in client/resources/wikibase.client.linkitem.init.js - About 2 hrs to fix

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

            _create: function () {
                var self = this;
    
                PARENT.prototype._create.call( this );
    
    

      Function _createListView has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              _createListView: function () {
                  var self = this,
                      listItemWidget = $.wikibase.entitytermsforlanguageview,
                      prefix = listItemWidget.prototype.widgetEventPrefix;
      
      

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

                _create: function () {
                    if ( !( this.options.value instanceof datamodel.Fingerprint )
                        || !Array.isArray( this.options.userLanguages )
                    ) {
                        throw new Error( 'Required option(s) missing' );
        Severity: Minor
        Found in view/resources/jquery/wikibase/jquery.wikibase.entitytermsview.js - About 2 hrs to fix

          Method run has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function run(): bool {
                  $change = $this->getChange();
                  $titles = $this->getTitles();
          
                  if ( !$change || $titles === [] ) {
          Severity: Minor
          Found in client/includes/Changes/InjectRCRecordsJob.php - About 2 hrs to fix

            Method getStatus has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function getStatus( WebRequest $req, RevisionRecord $latestRevision ): Status {
                    if ( $req->getCheck( 'restore' ) ) { // nearly the same as undoafter without undo
                        $olderRevision = $this->revisionLookup->getRevisionById( $req->getInt( 'restore' ) );
            
                        if ( !$olderRevision ) {
            Severity: Minor
            Found in repo/includes/Actions/EditEntityAction.php - About 2 hrs to fix

              Method getFormFields has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function getFormFields() {
                      $formFields = [
                          self::FIELD_LANG => [
                              'name' => self::FIELD_LANG,
                              'class' => HTMLContentLanguageField::class,
              Severity: Minor
              Found in repo/includes/Specials/SpecialNewProperty.php - About 2 hrs to fix

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

                        array $tags,
                        SpecialPageCopyrightView $copyrightView,
                        EntityNamespaceLookup $entityNamespaceLookup,
                        SummaryFormatter $summaryFormatter,
                        EntityTitleLookup $entityTitleLookup,
                Severity: Major
                Found in repo/includes/Specials/SpecialNewItem.php - About 2 hrs to fix

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

                          EntityTitleStoreLookup $entityTitleStoreLookup,
                          ExceptionLocalizer $exceptionLocalizer,
                          PropertyDataTypeLookup $dataTypeLookup,
                          SiteLookup $siteLookup,
                          SummaryFormatter $summaryFormatter,
                  Severity: Major
                  Found in repo/includes/Api/ApiHelperFactory.php - About 2 hrs to fix

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

                            HttpRequestFactory $httpRequestFactory,
                            IBufferingStatsdDataFactory $statsdDataFactory,
                            SettingsArray $repoSettings,
                            TemplateFactory $templateFactory,
                            EntityRevisionLookup $entityRevisionLookup,
                    Severity: Major
                    Found in repo/includes/Hooks/OutputPageBeforeHTMLHookHandler.php - About 2 hrs to fix

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

                              DispatchingEntityViewFactory $entityViewFactory,
                              DispatchingEntityMetaTagsCreatorFactory $entityMetaTagsCreatorFactory,
                              EntityTitleLookup $entityTitleLookup,
                              LanguageFallbackChainFactory $languageFallbackChainFactory,
                              EntityDataFormatProvider $entityDataFormatProvider,
                      Severity: Major
                      Found in repo/includes/ParserOutput/EntityParserOutputGeneratorFactory.php - About 2 hrs to fix

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

                                _initStatements: function () {
                                    this.options.buildStatementGroupListView( this.options.value, this.$statements );
                        
                                    // This is here to be sure there is never a duplicate id:
                                    $( '.wikibase-statementgrouplistview' )
                        view/resources/jquery/wikibase/jquery.wikibase.itemview.js on lines 74..82

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

                        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

                                _initStatements: function () {
                                    this.options.buildStatementGroupListView( this.options.value, this.$statements );
                        
                                    // This is here to be sure there is never a duplicate id:
                                    $( '.wikibase-statementgrouplistview' )
                        Severity: Major
                        Found in view/resources/jquery/wikibase/jquery.wikibase.itemview.js and 1 other location - About 2 hrs to fix
                        view/resources/jquery/wikibase/jquery.wikibase.propertyview.js on lines 92..100

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

                        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 (!options || !options.root) {
                                type = namespace + type;
                                if (!store._actions[type]) {
                                  console.error(("[vuex] unknown local action type: " + (args.type) + ", global type: " + type));
                                  return
                        Severity: Major
                        Found in view/lib/wikibase-tainted-ref/dist/tainted-ref.common.js and 1 other location - About 2 hrs to fix
                        view/lib/wikibase-tainted-ref/dist/tainted-ref.common.js on lines 2498..2504

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

                        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 (!options || !options.root) {
                                type = namespace + type;
                                if (!store._mutations[type]) {
                                  console.error(("[vuex] unknown local mutation type: " + (args.type) + ", global type: " + type));
                                  return
                        Severity: Major
                        Found in view/lib/wikibase-tainted-ref/dist/tainted-ref.common.js and 1 other location - About 2 hrs to fix
                        view/lib/wikibase-tainted-ref/dist/tainted-ref.common.js on lines 2481..2487

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

                        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 buildGeoShapeValidators( string $checkExistence = 'checkExistence' ): array {
                                $validators = $this->getCommonStringValidators( 240 );
                                //Don't forget to change message `wikibase-validator-illegal-geo-shape-title` modifying this
                                // Check for 'Data:' prefix, '.map' extension and illegal characters
                                $validators[] = new RegexValidator(
                        Severity: Major
                        Found in repo/includes/ValidatorBuilders.php and 1 other location - About 2 hrs to fix
                        repo/includes/ValidatorBuilders.php on lines 241..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 121.

                        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 buildTabularDataValidators( string $checkExistence = 'checkExistence' ): array {
                                $validators = $this->getCommonStringValidators( 240 );
                                $validators[] = new RegexValidator(
                                    '/^Data:[^\\[\\]#\\\:{|}]+\.tab$/u',
                                    false,
                        Severity: Major
                        Found in repo/includes/ValidatorBuilders.php and 1 other location - About 2 hrs to fix
                        repo/includes/ValidatorBuilders.php on lines 213..234

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

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

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

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

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

                        Refactorings

                        Further Reading

                        Method handleChange has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function handleChange( EntityChange $change, array $rootJobParams = [] ) {
                                $changeId = $this->getChangeIdForLog( $change );
                        
                                $this->logger->debug(
                                    '{method}: handling change #{changeId} ({changeType})',
                        Severity: Minor
                        Found in client/includes/Changes/ChangeHandler.php - About 1 hr to fix

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

                              public function __construct() {
                                  parent::__construct();
                          
                                  $this->addDescription( 'Populates Wikibase db with randomly generated entities and terms' );
                          
                          
                          Severity: Minor
                          Found in repo/maintenance/populateWithRandomEntitiesAndTerms.php - About 1 hr to fix

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

                                public function execute() {
                                    //TODO: more validation for options
                                    $shardingFactor = (int)$this->getOption( 'sharding-factor', 1 );
                                    $shard = (int)$this->getOption( 'shard', 0 );
                                    $batchSize = (int)$this->getOption( 'batch-size', 100 );
                            Severity: Minor
                            Found in repo/maintenance/DumpEntities.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language