wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

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

    public function __construct() {
        parent::__construct();
        global $IP;

        $this->addDescription( "CLI-based MediaWiki installation and configuration.\n" .
Severity: Major
Found in maintenance/install.php - About 2 hrs to fix

    Method transformI18nFile has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function transformI18nFile( $phpfile, $jsondir = null ) {
            if ( !$jsondir ) {
                // Assume the json directory should be in the same directory as the
                // .i18n.php file.
                $jsondir = dirname( $phpfile ) . "/i18n";
    Severity: Major
    Found in maintenance/generateJsonI18n.php - About 2 hrs to fix

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

                      } else if ( $selected.is( '.suggestions-special' ) ) {
                          if ( typeof context.config.special.select === 'function' ) {
                              // Allow the callback to decide whether to prevent default or not
                              if ( context.config.special.select.call( $selected, context.data.$textbox, 'keyboard' ) === true ) {
                                  preventDefault = false;
      Severity: Major
      Found in resources/src/jquery/jquery.suggestions.js and 1 other location - About 2 hrs to fix
      resources/src/jquery/jquery.suggestions.js on lines 476..483

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

      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

                      } else {
                          if ( typeof context.config.result.select === 'function' ) {
                              // Allow the callback to decide whether to prevent default or not
                              if ( context.config.result.select.call( $selected, context.data.$textbox, 'keyboard' ) === true ) {
                                  preventDefault = false;
      Severity: Major
      Found in resources/src/jquery/jquery.suggestions.js and 1 other location - About 2 hrs to fix
      resources/src/jquery/jquery.suggestions.js on lines 469..476

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

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

      OO.ui.CheckboxMultiselectInputWidget.prototype.setOptions = function ( options ) {
          const value = this.getValue();
      
          this.setOptionsData( options );
      
      
      Severity: Major
      Found in resources/lib/ooui/oojs-ui-core.js and 2 other locations - About 2 hrs to fix
      resources/lib/ooui/oojs-ui-core.js on lines 10684..10694
      resources/lib/ooui/oojs-ui-core.js on lines 11124..11134

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

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

      OO.ui.RadioSelectInputWidget.prototype.setOptions = function ( options ) {
          const value = this.getValue();
      
          this.setOptionsData( options );
      
      
      Severity: Major
      Found in resources/lib/ooui/oojs-ui-core.js and 2 other locations - About 2 hrs to fix
      resources/lib/ooui/oojs-ui-core.js on lines 10684..10694
      resources/lib/ooui/oojs-ui-core.js on lines 11351..11361

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

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

      OO.ui.DropdownInputWidget.prototype.setOptions = function ( options ) {
          const value = this.getValue();
      
          this.setOptionsData( options );
      
      
      Severity: Major
      Found in resources/lib/ooui/oojs-ui-core.js and 2 other locations - About 2 hrs to fix
      resources/lib/ooui/oojs-ui-core.js on lines 11124..11134
      resources/lib/ooui/oojs-ui-core.js on lines 11351..11361

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

      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

      OO.ui.SearchInputWidget.prototype.setReadOnly = function ( state ) {
          OO.ui.SearchInputWidget.super.prototype.setReadOnly.call( this, state );
          this.updateSearchIndicator();
          return this;
      };
      Severity: Major
      Found in resources/lib/ooui/oojs-ui-core.js and 1 other location - About 2 hrs to fix
      resources/src/mediawiki.widgets/mw.widgets.SearchInputWidget.js on lines 136..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 78.

      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.widgets.SearchInputWidget.prototype.setReadOnly = function ( state ) {
              mw.widgets.SearchInputWidget.super.prototype.setReadOnly.call( this, state );
              this.updateSearchIndicator();
              return this;
          };
      resources/lib/ooui/oojs-ui-core.js on lines 12160..12164

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

      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.textSelection.js has 256 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*!
       * These plugins provide extra functionality for interaction with textareas.
       *
       * - encapsulateSelection: Ported from skins/common/edit.js by Trevor Parscal
       *   © 2009 Wikimedia Foundation (GPLv2) - https://www.wikimedia.org
      Severity: Minor
      Found in resources/src/jquery/jquery.textSelection.js - About 2 hrs to fix

        File SVGReader.php has 256 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /**
         * Extraction of SVG image metadata.
         *
        Severity: Minor
        Found in includes/media/SVGReader.php - About 2 hrs to fix

          File SearchHandler.php has 256 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          namespace MediaWiki\Rest\Handler;
          
          use InvalidArgumentException;
          Severity: Minor
          Found in includes/Rest/Handler/SearchHandler.php - About 2 hrs to fix

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

                        } elseif ( $contextName === 'tplarg' ) {
                            # Triple-brace expansion
                            $bits = PPNode_Hash_Tree::splitRawTemplate( $contextChildren );
                            if ( $flags & PPFrame::NO_ARGS ) {
                                $newIterator = $this->virtualBracketedImplode(
            Severity: Major
            Found in includes/parser/PPFrame_Hash.php and 1 other location - About 2 hrs to fix
            includes/parser/PPFrame_Hash.php on lines 266..283

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

            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

                        } elseif ( $contextName === 'template' ) {
                            # Double-brace expansion
                            $bits = PPNode_Hash_Tree::splitRawTemplate( $contextChildren );
                            if ( $flags & PPFrame::NO_TEMPLATES ) {
                                $newIterator = $this->virtualBracketedImplode(
            Severity: Major
            Found in includes/parser/PPFrame_Hash.php and 1 other location - About 2 hrs to fix
            includes/parser/PPFrame_Hash.php on lines 283..300

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

            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 getGrantedPermissions( string $group ): array {
                    $rights = array_keys( array_filter( $this->groupPermissions[$group] ?? [] ) );
                    $inheritsFrom = $this->groupInheritance[$group] ?? false;
                    if ( $inheritsFrom !== false ) {
                        $rights = array_merge(
            Severity: Major
            Found in includes/Permissions/GroupPermissionsLookup.php and 1 other location - About 2 hrs to fix
            includes/Permissions/GroupPermissionsLookup.php on lines 140..152

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

            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 getRevokedPermissions( string $group ): array {
                    $rights = array_keys( array_filter( $this->revokePermissions[$group] ?? [] ) );
                    $inheritsFrom = $this->groupInheritance[$group] ?? false;
                    if ( $inheritsFrom !== false ) {
                        $rights = array_merge(
            Severity: Major
            Found in includes/Permissions/GroupPermissionsLookup.php and 1 other location - About 2 hrs to fix
            includes/Permissions/GroupPermissionsLookup.php on lines 119..131

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

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

                    HookContainer $hookContainer,
                    RevisionStore $revisionStore,
                    LBFactory $lbFactory,
                    JobQueueGroup $jobQueueGroup,
                    CommentStore $commentStore,
            Severity: Major
            Found in includes/page/DeletePage.php - About 2 hrs to fix

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

                      ApiMain $main,
                      $action,
                      RevisionLookup $revisionLookup,
                      SkinFactory $skinFactory,
                      LanguageNameUtils $languageNameUtils,
              Severity: Major
              Found in includes/api/ApiParse.php - About 2 hrs to fix

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

                        ApiQuery $queryModule,
                        $moduleName,
                        Language $contentLanguage,
                        LinkBatchFactory $linkBatchFactory,
                        NamespaceInfo $namespaceInfo,
                Severity: Major
                Found in includes/api/ApiQueryInfo.php - About 2 hrs to fix

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

                          ServiceOptions $options,
                          RevisionLookup $revisionLookup,
                          RevisionRenderer $revisionRenderer,
                          TitleFormatter $titleFormatter,
                          PageLookup $pageLookup,
                  Severity: Major
                  Found in includes/Rest/Handler/Helper/PageRestHelperFactory.php - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language