wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

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

            case 'dd':
                if (plural(number)) {
                    if (withoutSuffix) {
                        return result + 'dagar';
                    }
Severity: Major
Found in resources/lib/moment/locale/is.js and 1 other location - About 1 hr to fix
resources/lib/moment/locale/is.js on lines 78..87

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

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.hoursValuePicker = new ValuePickerWidget(
        this.model,
        {
            classes: [ 'mw-rcfilters-ui-datePopupWidget-hours' ],
            label: mw.msg( 'rcfilters-hours-title' ),
Severity: Major
Found in resources/src/mediawiki.rcfilters/ui/DatePopupWidget.js and 1 other location - About 1 hr to fix
resources/src/mediawiki.rcfilters/ui/DatePopupWidget.js on lines 35..44

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

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.daysValuePicker = new ValuePickerWidget(
        this.model,
        {
            classes: [ 'mw-rcfilters-ui-datePopupWidget-days' ],
            label: mw.msg( 'rcfilters-days-title' ),
Severity: Major
Found in resources/src/mediawiki.rcfilters/ui/DatePopupWidget.js and 1 other location - About 1 hr to fix
resources/src/mediawiki.rcfilters/ui/DatePopupWidget.js on lines 23..32

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

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 ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) {
            this._activate( this._focusNextTab( this.options.active - 1, false ) );
            return true;
        }
Severity: Major
Found in resources/lib/jquery.ui/jquery.ui.tabs.js and 1 other location - About 1 hr to fix
resources/lib/jquery.ui/jquery.ui.tabs.js on lines 229..232

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

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 (s.lookahead <= MAX_MATCH) {
        fill_window(s);
        if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH$1) {
          return BS_NEED_MORE;
        }
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 2236..2242

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

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

        edit: function ( title, transform ) {
            const api = this;

            title = String( title );

Severity: Minor
Found in resources/src/mediawiki.api/edit.js - About 1 hr to fix

    Function onload has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                    img.onload = function () {
                        let info, width, height, x, y, dx, dy, logicalWidth, logicalHeight;
    
                        // Fit the image within the previewSizexpreviewSize box
                        if ( img.width > img.height ) {
    Severity: Minor
    Found in resources/src/mediawiki.special.upload/upload.js - About 1 hr to fix

      Function stashEdit has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function stashEdit() {
              const textChanged = isTextChanged();
              const priority = textChanged ? PRIORITY_HIGH : PRIORITY_LOW;
      
              if ( stashReq ) {
      Severity: Minor
      Found in resources/src/mediawiki.action.edit/stash.js - About 1 hr to fix

        Function setup has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          setup(props, { emit }) {
            const wrappedItemsPerPage = useModelWrapper(
              toRef(props, "itemsPerPage"),
              emit,
              "update:itemsPerPage"
        Severity: Minor
        Found in resources/lib/codex/codex.js - About 1 hr to fix

          Function computeWeekdaysParse has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function computeWeekdaysParse() {
                  function cmpLenRev(a, b) {
                      return b.length - a.length;
                  }
          
          
          Severity: Minor
          Found in resources/lib/moment/moment.js - About 1 hr to fix

            Function extend has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            jQuery.extend = jQuery.fn.extend = function() {
                var options, name, src, copy, copyIsArray, clone,
                    target = arguments[ 0 ] || {},
                    i = 1,
                    length = arguments.length,
            Severity: Minor
            Found in resources/lib/jquery/jquery.js - About 1 hr to fix

              Function OoUiToolGroup has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              OO.ui.ToolGroup = function OoUiToolGroup( toolbar, config ) {
                  // Allow passing positional parameters inside the config object
                  if ( OO.isPlainObject( toolbar ) && config === undefined ) {
                      config = toolbar;
                      toolbar = config.toolbar;
              Severity: Minor
              Found in resources/lib/ooui/oojs-ui-toolbars.js - About 1 hr to fix

                Function onDocumentKeyDown has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                OO.ui.MenuSelectWidget.prototype.onDocumentKeyDown = function ( e ) {
                    let handled = false;
                
                    const currentItem = this.findHighlightedItem() || this.findFirstSelectedItem();
                
                
                Severity: Minor
                Found in resources/lib/ooui/oojs-ui-core.js - About 1 hr to fix

                  Function refresh has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      refresh: function() {
                          var menus,
                              icon = this.options.icons.submenu,
                              submenus = this.element.find( this.options.menus );
                  
                  
                  Severity: Minor
                  Found in resources/lib/jquery.ui/jquery.ui.menu.js - About 1 hr to fix

                    Function longest_match has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      const longest_match = (s, cur_match) => {
                    
                        let chain_length = s.max_chain_length;      /* max hash chain length */
                        let scan = s.strstart; /* current string */
                        let match;                       /* matched string */
                    Severity: Minor
                    Found in resources/lib/pako/pako_deflate.js - About 1 hr to fix

                      Function useStore has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            function useStore(pinia, hot) {
                                const currentInstance = vueDemi.getCurrentInstance();
                                pinia =
                                    // in test mode, ignore the argument provided as we can always retrieve a
                                    // pinia instance with getActivePinia()
                      Severity: Minor
                      Found in resources/lib/pinia/pinia.iife.js - About 1 hr to fix

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

                            private function getSessionInfoForRequest( WebRequest $request ) {
                                // Call all providers to fetch "the" session
                                $infos = [];
                                foreach ( $this->getProviders() as $provider ) {
                                    $info = $provider->provideSessionInfo( $request );
                        Severity: Minor
                        Found in includes/session/SessionManager.php - About 1 hr to fix

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

                              public function updateRevisionOn(
                                  $dbw,
                                  RevisionRecord $revision,
                                  $lastRevision = null,
                                  $lastRevIsRedirect = null
                          Severity: Minor
                          Found in includes/page/WikiPage.php - About 1 hr to fix

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

                                protected function compileLessString( $style, $stylePath, Context $context ) {
                                    static $cache;
                                    // @TODO: dependency injection
                                    if ( !$cache ) {
                                        $cache = MediaWikiServices::getInstance()->getObjectCacheFactory()
                            Severity: Minor
                            Found in includes/ResourceLoader/FileModule.php - About 1 hr to fix

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

                                  public function providerAllowsAuthenticationDataChange(
                                      AuthenticationRequest $req, $checkData = true
                                  ) {
                                      if ( get_class( $req ) !== TemporaryPasswordAuthenticationRequest::class ) {
                                          // We don't really ignore it, but this is what the caller expects.
                                Severity
                                Category
                                Status
                                Source
                                Language