wikimedia/mediawiki-core

View on GitHub

Showing 9,710 of 11,773 total issues

File apisandbox.js has 1648 lines of code (exceeds 250 allowed). Consider refactoring.
Open

( function () {
    'use strict';
    var ApiSandbox, Util, WidgetMethods, Validators,
        windowManager,
        formatDropdown,
Severity: Major
Found in resources/src/mediawiki.special.apisandbox/apisandbox.js - About 4 days to fix

    MediaWikiServices has 220 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class MediaWikiServices extends ServiceContainer {
        use NonSerializableTrait;
    
        /**
         * @var bool
    Severity: Major
    Found in includes/MediaWikiServices.php - About 4 days to fix

      Database has 206 functions (exceeds 20 allowed). Consider refactoring.
      Open

      abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAwareInterface {
          /** @var CriticalSectionProvider|null */
          protected $csProvider;
          /** @var LoggerInterface */
          protected $logger;
      Severity: Major
      Found in includes/libs/rdbms/database/Database.php - About 4 days to fix

        File oojs-ui-windows.js has 1541 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-windows.js - About 4 days to fix

          Method makeFormattedData has 822 lines of code (exceeds 25 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: Major
          Found in includes/media/FormatMetadata.php - About 4 days to fix

            File DefaultPreferencesFactory.php has 1521 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/preferences/DefaultPreferencesFactory.php - About 4 days to fix

              File jquery.ui.datepicker.js has 1518 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /*!
               * jQuery UI Datepicker 1.9.2
               * http://jqueryui.com
               *
               * Copyright 2012 jQuery Foundation and other contributors
              Severity: Major
              Found in resources/lib/jquery.ui/jquery.ui.datepicker.js - About 4 days to fix

                File SpecialPageFactory.php has 1509 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /**
                 * Factory for handling the special page list and generating SpecialPage objects.
                 *
                 * This program is free software; you can redistribute it and/or modify
                Severity: Major
                Found in includes/specialpage/SpecialPageFactory.php - About 4 days to fix

                  File LocalFile.php has 1498 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/filerepo/file/LocalFile.php - About 3 days to fix

                    OutputPage has 199 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class OutputPage extends ContextSource {
                        use ProtectedHookAccessorTrait;
                    
                        /** Output CSP policies as headers */
                        public const CSP_HEADERS = 'headers';
                    Severity: Major
                    Found in includes/Output/OutputPage.php - About 3 days to fix

                      File Linker.php has 1475 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      /**
                       * Methods to make links and related items.
                       *
                       * This program is free software; you can redistribute it and/or modify
                      Severity: Major
                      Found in includes/linker/Linker.php - About 3 days to fix

                        File DatabaseBlockStore.php has 1440 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        /**
                         * Class for DatabaseBlock objects to interact with the database
                         *
                         * This program is free software; you can redistribute it and/or modify
                        Severity: Major
                        Found in includes/block/DatabaseBlockStore.php - About 3 days to fix

                          File Skin.php has 1438 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/skins/Skin.php - About 3 days to fix

                            File DifferenceEngine.php has 1431 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            <?php
                            /**
                             * User interface for the difference engine.
                             *
                             * This program is free software; you can redistribute it and/or modify
                            Severity: Major
                            Found in includes/diff/DifferenceEngine.php - About 3 days to fix

                              File FormatMetadata.php has 1399 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              <?php
                              /**
                               * Formatting of image metadata values into human readable form.
                               *
                               * This program is free software; you can redistribute it and/or modify
                              Severity: Major
                              Found in includes/media/FormatMetadata.php - About 3 days to fix

                                File UploadBase.php has 1378 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                <?php
                                /**
                                 * Base class for the backend of file upload.
                                 *
                                 * This program is free software; you can redistribute it and/or modify
                                Severity: Major
                                Found in includes/upload/UploadBase.php - About 3 days to fix

                                  Function execute has a Cognitive Complexity of 173 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public function execute() {
                                          // The data is hot but user-dependent, like page views, so we set vary cookies
                                          $this->getMain()->setCacheMode( 'anon-public-user-private' );
                                  
                                          // Get parameters
                                  Severity: Minor
                                  Found in includes/api/ApiParse.php - About 3 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 LoadBalancer.php has 1339 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/loadbalancer/LoadBalancer.php - About 3 days to fix

                                    File Article.php has 1328 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/Article.php - About 3 days to fix

                                      File ParserOutput.php has 1328 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/parser/ParserOutput.php - About 3 days to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language