wikimedia/mediawiki-core

View on GitHub

Showing 11,773 of 11,773 total issues

Function Pinia has 1684 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var Pinia = (function (exports, vueDemi) {
  'use strict';

  /**
   * setActivePinia must be called to handle SSR at the top of functions like
Severity: Major
Found in resources/lib/pinia/pinia.iife.js - About 1 wk to fix

    File oojs-ui-widgets.js has 2564 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     * OOUI v0.49.1
     * https://www.mediawiki.org/wiki/OOUI
     *
     * Copyright 2011–2024 OOUI Team and other contributors.
    Severity: Major
    Found in resources/lib/ooui/oojs-ui-widgets.js - About 1 wk to fix

      File Language.php has 2503 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * This program is free software; you can redistribute it and/or modify
       * it under the terms of the GNU General Public License as published by
       * the Free Software Foundation; either version 2 of the License, or
      Severity: Major
      Found in includes/language/Language.php - About 1 wk to fix

        Function baseCreateRenderer has 1369 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function baseCreateRenderer(options, createHydrationFns) {
            const target = getGlobalThis();
            target.__VUE__ = true;
            {
              setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
        Severity: Major
        Found in resources/lib/vue/vue.global.js - About 6 days to fix

          File OutputPage.php has 2401 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /**
           * Preparation for the final page rendering.
           *
           * This program is free software; you can redistribute it and/or modify
          Severity: Major
          Found in includes/Output/OutputPage.php - About 6 days to fix

            File ServiceWiring.php has 2274 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /**
             * Service implementations for %MediaWiki core.
             *
             * This file returns the array loaded by the MediaWikiServices class
            Severity: Major
            Found in includes/ServiceWiring.php - About 6 days to fix

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

              <?php
              /**
               * API for MediaWiki 1.17+
               *
               * Copyright © 2011 Sam Reed
              Severity: Major
              Found in includes/api/ApiQueryLangBacklinks.php and 1 other location - About 6 days to fix
              includes/api/ApiQueryIWBacklinks.php on lines 1..224

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

              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

              <?php
              /**
               * API for MediaWiki 1.17+
               *
               * Copyright © 2010 Sam Reed
              Severity: Major
              Found in includes/api/ApiQueryIWBacklinks.php and 1 other location - About 6 days to fix
              includes/api/ApiQueryLangBacklinks.php on lines 1..223

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

              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 buildDomTreeArrayFromText has a Cognitive Complexity of 300 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function buildDomTreeArrayFromText( $text, $flags ) {
                      $forInclusion = ( $flags & self::DOM_FOR_INCLUSION );
                      $langConversionDisabled = ( $flags & self::DOM_LANG_CONVERSION_DISABLED );
              
                      $xmlishElements = $this->parser->getStripList();
              Severity: Minor
              Found in includes/parser/Preprocessor_Hash.php - About 6 days to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              File Database.php has 2205 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /**
               * This program is free software; you can redistribute it and/or modify
               * it under the terms of the GNU General Public License as published by
               * the Free Software Foundation; either version 2 of the License, or
              Severity: Major
              Found in includes/libs/rdbms/database/Database.php - About 6 days to fix

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

                            'GrantPermissions' => [
                                'basic' => [
                                    'autocreateaccount' => true,
                                    'autoconfirmed' => true,
                                    'autopatrol' => true,
                Severity: Major
                Found in includes/config-schema.php and 1 other location - About 6 days to fix
                includes/MainConfigSchema.php on lines 8802..8970

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

                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

                        'default' => [
                            'basic' => [
                                'autocreateaccount' => true,
                                'autoconfirmed' => true,
                                'autopatrol' => true,
                Severity: Major
                Found in includes/MainConfigSchema.php and 1 other location - About 6 days to fix
                includes/config-schema.php on lines 1554..1722

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

                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 makeFormattedData has a Cognitive Complexity of 283 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function makeFormattedData( $tags ) {
                        $resolutionunit = !isset( $tags['ResolutionUnit'] ) || $tags['ResolutionUnit'] == 2 ? 2 : 3;
                        unset( $tags['ResolutionUnit'] );
                
                        // Ignore these complex values
                Severity: Minor
                Found in includes/media/FormatMetadata.php - About 5 days to fix

                Cognitive Complexity

                Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                A method's cognitive complexity is based on a few simple rules:

                • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                • Code is considered more complex for each "break in the linear flow of the code"
                • Code is considered more complex when "flow breaking structures are nested"

                Further reading

                Function Vuex has 1130 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                var Vuex = (function (vue) {
                  'use strict';
                
                  var storeKey = 'store';
                
                
                Severity: Major
                Found in resources/lib/vuex/vuex.global.js - About 5 days to fix

                  File RevisionStore.php has 2010 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /**
                   * This program is free software; you can redistribute it and/or modify
                   * it under the terms of the GNU General Public License as published by
                   * the Free Software Foundation; either version 2 of the License, or
                  Severity: Major
                  Found in includes/Revision/RevisionStore.php - About 5 days to fix

                    File Title.php has 1901 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    /**
                     * Representation of a title within MediaWiki.
                     *
                     * See Title.md
                    Severity: Major
                    Found in includes/title/Title.php - About 5 days to fix

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

                      ;(function (global, factory) {
                         typeof exports === 'object' && typeof module !== 'undefined'
                             && typeof require === 'function' ? factory(require('../moment')) :
                         typeof define === 'function' && define.amd ? define(['../moment'], factory) :
                         factory(global.moment)
                      Severity: Major
                      Found in resources/lib/moment/locale/gom-latn.js and 1 other location - About 5 days to fix
                      resources/lib/moment/locale/gom-deva.js on lines 5..135

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

                      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

                      ;(function (global, factory) {
                         typeof exports === 'object' && typeof module !== 'undefined'
                             && typeof require === 'function' ? factory(require('../moment')) :
                         typeof define === 'function' && define.amd ? define(['../moment'], factory) :
                         factory(global.moment)
                      Severity: Major
                      Found in resources/lib/moment/locale/gom-deva.js and 1 other location - About 5 days to fix
                      resources/lib/moment/locale/gom-latn.js on lines 5..135

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

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

                      
                      /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
                      (function (global, factory) {
                        typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
                        typeof define === 'function' && define.amd ? define(['exports'], factory) :
                      Severity: Major
                      Found in resources/lib/pako/pako_deflate.js - About 5 days to fix

                        File User.php has 1823 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        /**
                         * Implements the User class for the %MediaWiki software.
                         *
                         * This program is free software; you can redistribute it and/or modify
                        Severity: Major
                        Found in includes/user/User.php - About 4 days to fix
                          Severity
                          Category
                          Status
                          Source
                          Language