wikimedia/mediawiki-core

View on GitHub

Showing 9,711 of 11,779 total issues

File ChangesListSpecialPage.php has 1321 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/specialpage/ChangesListSpecialPage.php - About 3 days to fix

    File SwiftFileBackend.php has 1299 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * OpenStack Swift based file backend.
     *
     * This program is free software; you can redistribute it and/or modify
    Severity: Major
    Found in includes/libs/filebackend/SwiftFileBackend.php - About 3 days to fix

      File SpecialUndelete.php has 1294 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * Implements Special:Undelete
       *
       * This program is free software; you can redistribute it and/or modify
      Severity: Major
      Found in includes/specials/SpecialUndelete.php - About 3 days to fix

        Function UMD has 665 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            })(commonjsGlobal, function UMD() {
              function fuzzysortNew(instanceOptions) {
                var fuzzysort = {
                  single: function single(search, target, options) {
                    if (search == 'farzher') return {
        Severity: Major
        Found in resources/lib/qunitjs/qunit.js - About 3 days to fix

          Function getMetadata has a Cognitive Complexity of 161 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function getMetadata( $filename ) {
                  self::$pngSig = pack( "C8", 137, 80, 78, 71, 13, 10, 26, 10 );
                  self::$crcSize = 4;
                  /* based on list at http://owl.phy.queensu.ca/~phil/exiftool/TagNames/PNG.html#TextualData
                   * and https://www.w3.org/TR/PNG/#11keywords
          Severity: Minor
          Found in includes/media/PNGMetadataExtractor.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

          Title has 165 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Title implements LinkTarget, PageIdentity {
              use WikiAwareEntityTrait;
              use LinkTargetTrait;
          
              /** @var MapCacheLRU|null */
          Severity: Major
          Found in includes/title/Title.php - About 3 days to fix

            File SQLPlatform.php has 1253 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/platform/SQLPlatform.php - About 3 days to fix

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

                File chosen.jquery.js has 1238 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /*!
                Chosen, a Select Box Enhancer for jQuery and Prototype
                by Patrick Filler for Harvest, http://getharvest.com
                
                Version 1.8.2
                Severity: Major
                Found in resources/lib/jquery.chosen/chosen.jquery.js - About 3 days to fix

                  Function getHelpInternal has a Cognitive Complexity of 155 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private static function getHelpInternal( IContextSource $context, array $modules,
                          array $options, &$haveModules
                      ) {
                          $out = '';
                  
                  
                  Severity: Minor
                  Found in includes/api/ApiHelp.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

                  Function diff has 622 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    QUnit.diff = function () {
                      function DiffMatchPatch() {}
                  
                      //  DIFF FUNCTIONS
                  
                  
                  Severity: Major
                  Found in resources/lib/qunitjs/qunit.js - About 3 days to fix

                    Function setup has a Cognitive Complexity of 152 (exceeds 5 allowed). Consider refactoring.
                    Open

                      setup(props, { emit, slots, attrs }) {
                        const computedMenuItems = computed(() => {
                          const menuItemsWithFooter = props.footer && props.menuItems ? [...props.menuItems, props.footer] : props.menuItems;
                          return menuItemsWithFooter.map((menuItem) => __spreadProps(__spreadValues({}, menuItem), {
                            id: useGeneratedId("menu-item")
                    Severity: Minor
                    Found in resources/lib/codex/codex.js - 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

                    Function sprintfDate has a Cognitive Complexity of 151 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function sprintfDate( $format, $ts, DateTimeZone $zone = null, &$ttl = 'unused' ) {
                            // @phan-suppress-previous-line PhanTypeMismatchDefault Type mismatch on pass-by-ref args
                            $s = '';
                            $raw = false;
                            $roman = false;
                    Severity: Minor
                    Found in includes/language/Language.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 WatchedItemStore.php has 1172 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    use MediaWiki\Cache\LinkBatchFactory;
                    use MediaWiki\Config\ServiceOptions;
                    use MediaWiki\Deferred\DeferredUpdates;
                    Severity: Major
                    Found in includes/watcheditem/WatchedItemStore.php - About 3 days to fix

                      DBConnRef has 152 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class DBConnRef implements IMaintainableDatabase {
                          /** @var ILoadBalancer */
                          private $lb;
                          /** @var Database|null Live connection handle */
                          private $conn;
                      Severity: Major
                      Found in includes/libs/rdbms/database/DBConnRef.php - About 3 days to fix

                        Function check has a Cognitive Complexity of 147 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function check( $fix = false, $xml = '' ) {
                                $dbr = $this->getReplicaDB();
                                if ( $fix ) {
                                    print "Checking, will fix errors if possible...\n";
                                } else {
                        Severity: Minor
                        Found in maintenance/storage/checkStorage.php - About 2 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 execute has a Cognitive Complexity of 146 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function execute() {
                                $this->useTransactionalTimeLimit();
                        
                                $user = $this->getUser();
                                $params = $this->extractRequestParams();
                        Severity: Minor
                        Found in includes/api/ApiEditPage.php - About 2 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 execute has a Cognitive Complexity of 146 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function execute() {
                                // Before doing anything at all, let's check permissions
                                $this->checkUserRightsAny( 'deletedhistory' );
                        
                                $this->addDeprecation( 'apiwarn-deprecation-deletedrevs', 'action=query&list=deletedrevs' );
                        Severity: Minor
                        Found in includes/api/ApiQueryDeletedrevs.php - About 2 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

                        Language has 149 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class Language implements Bcp47Code {
                            use DebugInfoTrait;
                        
                            /** @var string */
                            public $mCode;
                        Severity: Major
                        Found in includes/language/Language.php - About 2 days to fix

                          File SqlBagOStuff.php has 1141 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          <?php
                          /**
                           * Object caching using a SQL database.
                           *
                           * This program is free software; you can redistribute it and/or modify
                          Severity: Major
                          Found in includes/objectcache/SqlBagOStuff.php - About 2 days to fix
                            Severity
                            Category
                            Status
                            Source
                            Language