wikimedia/mediawiki-core

View on GitHub

Showing 9,710 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

              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

                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

                      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

                          File AuthManager.php has 1809 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          <?php
                          /**
                           * Authentication (and possibly Authorization in the future) system entry point
                           *
                           * This program is free software; you can redistribute it and/or modify
                          Severity: Major
                          Found in includes/auth/AuthManager.php - About 4 days to fix

                            File pinia.iife.js has 1687 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            /*!
                              * pinia v2.0.16
                              * (c) 2022 Eduardo San Martin Morote
                              * @license MIT
                              */
                            Severity: Major
                            Found in resources/lib/pinia/pinia.iife.js - About 4 days to fix

                              Method getIcuRules has 910 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function getIcuRules() {
                                      $rules = [];
                              
                                      # transliteration rules developed for Palmleaf.org
                                      $rules['ban-x-palmleaf'] = <<<'EOF'
                              Severity: Major
                              Found in includes/language/converters/BanConverter.php - About 4 days to fix

                                Function Vuex has a Cognitive Complexity of 220 (exceeds 5 allowed). Consider refactoring.
                                Open

                                var Vuex = (function (vue) {
                                  'use strict';
                                
                                  var storeKey = 'store';
                                
                                
                                Severity: Minor
                                Found in resources/lib/vuex/vuex.global.js - About 4 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 ApiMain.php has 1669 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                <?php
                                /**
                                 * Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
                                 *
                                 * This program is free software; you can redistribute it and/or modify
                                Severity: Major
                                Found in includes/api/ApiMain.php - About 4 days to fix

                                  File WikiPage.php has 1651 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/page/WikiPage.php - About 4 days to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language