wikimedia/mediawiki-core

View on GitHub

Showing 9,711 of 11,779 total issues

Method sprintfDate has 449 lines of code (exceeds 25 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: Major
Found in includes/language/Language.php - About 2 days to fix

    Function createHydrationFunctions has 442 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function createHydrationFunctions(rendererInternals) {
        const {
          mt: mountComponent,
          p: patch,
          o: {
    Severity: Major
    Found in resources/lib/vue/vue.global.js - About 2 days to fix

      File ApiParse.php has 901 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

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

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

            public function execute() {
                $services = $this->getServiceContainer();
                $permissionManager = $services->getPermissionManager();
        
                $found = 0;
        Severity: Minor
        Found in maintenance/importImages.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 convertGrammarKk_cyrl has a Cognitive Complexity of 108 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function convertGrammarKk_cyrl( $word, $case ) {
                $grammarForms =
                    MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::GrammarForms );
                if ( isset( $grammarForms['kk-kz'][$case][$word] ) ) {
                    return $grammarForms['kk-kz'][$case][$word];
        Severity: Minor
        Found in includes/languages/LanguageKk_cyrl.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

        Method execute has 432 lines of code (exceeds 25 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: Major
        Found in includes/api/ApiParse.php - About 2 days to fix

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

          /**
           * TableSorter for MediaWiki
           *
           * Written 2011 Leo Koppelkamm
           * Based on tablesorter.com plugin, written (c) 2007 Christian Bach.
          Severity: Major
          Found in resources/src/jquery.tablesorter/jquery.tablesorter.js - About 2 days to fix

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

                public function execute() {
                    $params = $this->extractRequestParams();
            
                    $prop = array_fill_keys( $params['prop'], true );
            
            
            Severity: Minor
            Found in includes/api/ApiQueryImageInfo.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 buildContentNavigationUrlsInternal has a Cognitive Complexity of 105 (exceeds 5 allowed). Consider refactoring.
            Open

                private function buildContentNavigationUrlsInternal() {
                    if ( $this->contentNavigationCached ) {
                        return $this->contentNavigationCached;
                    }
                    // Display tabs for the relevant title rather than always the title itself
            Severity: Minor
            Found in includes/skins/SkinTemplate.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

            File ImagePage.php has 871 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/ImagePage.php - About 2 days to fix

              File ApiUpload.php has 871 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /**
               * Copyright © 2008 - 2010 Bryan Tong Minh <Bryan.TongMinh@Gmail.com>
               *
               * This program is free software; you can redistribute it and/or modify
              Severity: Major
              Found in includes/api/ApiUpload.php - About 2 days to fix

                Method profilePreferences has 421 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function profilePreferences(
                        User $user, IContextSource $context, &$defaultPreferences
                    ) {
                        // retrieving user name for GENDER and misc.
                        $userName = $user->getName();
                Severity: Major
                Found in includes/preferences/DefaultPreferencesFactory.php - About 2 days to fix

                  ParserOptions has 109 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class ParserOptions {
                  
                      /**
                       * Default values for all options that are relevant for caching.
                       * @see self::getDefaults()
                  Severity: Major
                  Found in includes/parser/ParserOptions.php - About 2 days to fix

                    Method pageInfo has 418 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function pageInfo() {
                            $user = $this->getUser();
                            $lang = $this->getLanguage();
                            $title = $this->getTitle();
                            $id = $title->getArticleID();
                    Severity: Major
                    Found in includes/actions/InfoAction.php - About 2 days to fix

                      File FileModule.php has 858 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/FileModule.php - About 2 days to fix

                        File WikiImporter.php has 855 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        /**
                         * MediaWiki page data importer.
                         *
                         * Copyright © 2003,2005 Brooke Vibber <bvibber@wikimedia.org>
                        Severity: Major
                        Found in includes/import/WikiImporter.php - About 2 days to fix

                          File mediawiki.jqueryMsg.js has 852 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          /*!
                          * Experimental advanced wikitext parser-emitter.
                          * See: https://www.mediawiki.org/wiki/Extension:UploadWizard/MessageParser for docs
                          *
                          * @author neilk@wikimedia.org
                          Severity: Major
                          Found in resources/src/mediawiki.jqueryMsg/mediawiki.jqueryMsg.js - About 2 days to fix

                            Function run has a Cognitive Complexity of 102 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function run( $resultPageSet = null ) {
                                    $user = $this->getUser();
                                    /* Get the parameters of the request. */
                                    $params = $this->extractRequestParams();
                            
                            
                            Severity: Minor
                            Found in includes/api/ApiQueryRecentChanges.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

                            Method execute has 409 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function execute() {
                                    $this->useTransactionalTimeLimit();
                            
                                    $user = $this->getUser();
                                    $params = $this->extractRequestParams();
                            Severity: Major
                            Found in includes/api/ApiEditPage.php - About 2 days to fix

                              File RecentChange.php has 848 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              <?php
                              /**
                               * Utility class for creating and accessing recent change entries.
                               *
                               * This program is free software; you can redistribute it and/or modify
                              Severity: Major
                              Found in includes/changes/RecentChange.php - About 2 days to fix
                                Severity
                                Category
                                Status
                                Source
                                Language