wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Method deleteByWhere has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function deleteByWhere( $dbr, $startMessage, $where ) {
        $this->output( $startMessage . "...\n" );
        $dryRun = $this->hasOption( 'dry-run' );

        $iterator = new BatchRowIterator(
Severity: Minor
Found in maintenance/cleanupPreferences.php - About 1 hr to fix

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

        public function execute() {
            global $IP;
    
            $files = $this->getFiles();
            $chunkSize = (int)ceil( count( $files ) / 72 );
    Severity: Minor
    Found in maintenance/findDeprecated.php - About 1 hr to fix

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

          public static function listDropdownOptionsOoui( $options ) {
              $optionsOoui = [];
      
              foreach ( $options as $text => $value ) {
                  if ( is_array( $value ) ) {
      Severity: Major
      Found in includes/Html/Html.php and 1 other location - About 1 hr to fix
      includes/xml/Xml.php on lines 630..645

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

      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 ( $thislen == 3 ) {
                          // three quotes - open or close bold
                          if ( $state === 'b' ) {
                              $output .= '</b>';
                              $state = '';
      Severity: Major
      Found in includes/parser/Parser.php and 1 other location - About 1 hr to fix
      includes/parser/Parser.php on lines 2093..2150

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

      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

          protected function getPasswordBox( $var, $label, $attribs = [], $helpData = "" ) {
              $name = $this->getName() . '_' . $var;
              $value = $this->getVar( $var );
              if ( !isset( $attribs ) ) {
                  $attribs = [];
      Severity: Major
      Found in includes/installer/DatabaseForm.php and 1 other location - About 1 hr to fix
      includes/installer/DatabaseForm.php on lines 54..69

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

      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 ( $thislen == 2 ) {
                          // two quotes - open or close italics
                          if ( $state === 'i' ) {
                              $output .= '</i>';
                              $state = '';
      Severity: Major
      Found in includes/parser/Parser.php and 1 other location - About 1 hr to fix
      includes/parser/Parser.php on lines 2111..2129

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

      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

          public static function listDropdownOptionsOoui( $options ) {
              $optionsOoui = [];
      
              foreach ( $options as $text => $value ) {
                  if ( is_array( $value ) ) {
      Severity: Major
      Found in includes/xml/Xml.php and 1 other location - About 1 hr to fix
      includes/Html/Html.php on lines 1213..1228

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

      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

          protected function getTextBox( $var, $label, $attribs = [], $helpData = "" ) {
              $name = $this->getName() . '_' . $var;
              $value = $this->getVar( $var );
              if ( !isset( $attribs ) ) {
                  $attribs = [];
      Severity: Major
      Found in includes/installer/DatabaseForm.php and 1 other location - About 1 hr to fix
      includes/installer/DatabaseForm.php on lines 82..97

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

      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

            if (nextlen === 0) {
              max_count = 138;
              min_count = 3;
      
            } else if (curlen === nextlen) {
      Severity: Major
      Found in resources/lib/pako/pako_deflate.js and 1 other location - About 1 hr to fix
      resources/lib/pako/pako_deflate.js on lines 807..818

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

      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

              simpleParse: function ( message, parameters ) {
                  return message.replace( /\$(\d+)/g, function ( str, match ) {
                      var index = parseInt( match, 10 ) - 1;
      
                      return parameters[ index ] !== undefined ? parameters[ index ] : '$' + match;
      Severity: Major
      Found in resources/lib/jquery.i18n/src/jquery.i18n.parser.js and 1 other location - About 1 hr to fix
      resources/lib/jquery.i18n/src/jquery.i18n.js on lines 265..270

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

      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

            if (nextlen === 0) {
              max_count = 138;
              min_count = 3;
      
            } else if (curlen === nextlen) {
      Severity: Major
      Found in resources/lib/pako/pako_deflate.js and 1 other location - About 1 hr to fix
      resources/lib/pako/pako_deflate.js on lines 878..889

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

      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

              parse: function ( message, parameters ) {
                  return message.replace( /\$(\d+)/g, function ( str, match ) {
                      var index = parseInt( match, 10 ) - 1;
                      return parameters[ index ] !== undefined ? parameters[ index ] : '$' + match;
                  } );
      Severity: Major
      Found in resources/lib/jquery.i18n/src/jquery.i18n.js and 1 other location - About 1 hr to fix
      resources/lib/jquery.i18n/src/jquery.i18n.parser.js on lines 29..35

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

      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.Window.prototype.open = function ( data ) {
          if ( !this.manager ) {
              throw new Error( 'Cannot open window, must be attached to a manager' );
          }
      
      
      Severity: Major
      Found in resources/lib/ooui/oojs-ui-windows.js and 1 other location - About 1 hr to fix
      resources/lib/ooui/oojs-ui-windows.js on lines 2496..2502

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

      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

          this.$input.on( {
              focus: this.onLookupInputFocus.bind( this ),
              blur: this.onLookupInputBlur.bind( this ),
              mousedown: this.onLookupInputMouseDown.bind( this )
          } );
      Severity: Major
      Found in resources/lib/ooui/oojs-ui-widgets.js and 1 other location - About 1 hr to fix
      resources/lib/ooui/oojs-ui-core.js on lines 11509..11513

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

      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.Window.prototype.close = function ( data ) {
          if ( !this.manager ) {
              throw new Error( 'Cannot close window, must be attached to a manager' );
          }
      
      
      Severity: Major
      Found in resources/lib/ooui/oojs-ui-windows.js and 1 other location - About 1 hr to fix
      resources/lib/ooui/oojs-ui-windows.js on lines 2474..2480

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

      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.mixin.ClippableElement.prototype.setClippableContainer = function ( $clippableContainer ) {
          this.$clippableContainer = $clippableContainer;
          if ( this.$clippable ) {
              this.clip();
          }
      Severity: Major
      Found in resources/lib/ooui/oojs-ui-core.js and 1 other location - About 1 hr to fix
      resources/lib/ooui/oojs-ui-core.js on lines 5088..5093

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

      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

          this.$input.on( {
              keypress: this.onKeyPress.bind( this ),
              blur: this.onBlur.bind( this ),
              focus: this.onFocus.bind( this )
          } );
      Severity: Major
      Found in resources/lib/ooui/oojs-ui-core.js and 1 other location - About 1 hr to fix
      resources/lib/ooui/oojs-ui-widgets.js on lines 684..688

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

      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.mixin.FloatableElement.prototype.setFloatableContainer = function ( $floatableContainer ) {
          this.$floatableContainer = $floatableContainer;
          if ( this.$floatable ) {
              this.position();
          }
      Severity: Major
      Found in resources/lib/ooui/oojs-ui-core.js and 1 other location - About 1 hr to fix
      resources/lib/ooui/oojs-ui-core.js on lines 5507..5512

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

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

          return hooks[ name ] || ( hooks[ name ] = ( function () {
              let memory;
              const fns = [];
              function rethrow( e ) {
                  setTimeout( () => {
      Severity: Minor
      Found in resources/src/mediawiki.base/mediawiki.base.js - About 1 hr to fix

        Function addDynamicParamWidget has 42 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    addDynamicParamWidget = function () {
                        // Check name is filled in
                        const name = dynamicParamNameWidget.getValue().trim();
                        if ( name === '' ) {
                            dynamicParamNameWidget.focus();
        Severity: Minor
        Found in resources/src/mediawiki.special.apisandbox/apisandbox.js - About 1 hr to fix
          Severity
          Category
          Status
          Source
          Language