wikimedia/mediawiki-core

View on GitHub

Showing 9,426 of 11,461 total issues

File FileRepo.php has 989 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * @defgroup FileRepo File Repository
 *
 * @brief This module handles how MediaWiki interacts with filesystems.
Severity: Major
Found in includes/filerepo/FileRepo.php - About 2 days to fix

    File SpecialVersion.php has 985 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Copyright © 2005 Ævar Arnfjörð Bjarmason
     *
     * This program is free software; you can redistribute it and/or modify
    Severity: Major
    Found in includes/specials/SpecialVersion.php - About 2 days to fix

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

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

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

            public function execute() {
                $db = $this->getDB();
                $params = $this->extractRequestParams();
                $this->requireMaxOneParameter( $params, 'userids', 'users' );
        
        
        Severity: Minor
        Found in includes/api/ApiQueryUsers.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 LoginSignupSpecialPage.php has 967 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * Holds shared logic for login and account creation pages.
         *
         * This program is free software; you can redistribute it and/or modify
        Severity: Major
        Found in includes/specialpage/LoginSignupSpecialPage.php - About 2 days to fix

          File DerivedPageDataUpdater.php has 959 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/Storage/DerivedPageDataUpdater.php - About 2 days to fix

            File ApiPageSet.php has 958 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

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

              Function handleInternalLinks2 has a Cognitive Complexity of 117 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function handleInternalLinks2( &$s ) {
                      static $tc = false, $e1, $e1_img;
                      # the % is needed to support urlencoded titles as well
                      if ( !$tc ) {
                          $tc = Title::legalChars() . '#%';
              Severity: Minor
              Found in includes/parser/Parser.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 117 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function execute() {
                      $text = $this->text;
                      # Parsing through the text line by line.  The main thing
                      # happening here is handling of block-level elements p, pre,
                      # and making lists from lines starting with * # : etc.
              Severity: Minor
              Found in includes/parser/BlockLevelPass.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 BanConverter.php has 949 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/converters/BanConverter.php - About 2 days to fix

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

                  Method __construct has 462 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function __construct(
                          $name,
                          $restriction,
                          UserIdentityUtils $userIdentityUtils,
                          TempUserConfig $tempUserConfig
                  Severity: Major
                  Found in includes/specialpage/ChangesListSpecialPage.php - About 2 days to fix

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

                    /*!
                     * Defines mw.loader, the infrastructure for loading ResourceLoader
                     * modules.
                     *
                     * This file is appended directly to the code in startup/mediawiki.js
                    Severity: Major
                    Found in resources/src/startup/mediawiki.loader.js - About 2 days to fix

                      Function recache has a Cognitive Complexity of 113 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function recache( $code ) {
                              if ( !$code ) {
                                  throw new InvalidArgumentException( "Invalid language code requested" );
                              }
                              $this->recachedLangs[ $code ] = true;
                      Severity: Minor
                      Found in includes/language/LocalisationCache.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 run has a Cognitive Complexity of 113 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function run( ApiPageSet $resultPageSet = null ) {
                              $params = $this->extractRequestParams( false );
                      
                              // If any of those parameters are used, work in 'enumeration' mode.
                              // Enum mode can only be used when exactly one page is provided.
                      Severity: Minor
                      Found in includes/api/ApiQueryRevisions.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 MessageCache.php has 918 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/MessageCache.php - About 2 days to fix

                        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

                          File ApiParse.php has 902 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

                            Severity
                            Category
                            Status
                            Source
                            Language