wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Method getParametersForApi has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getParametersForApi() {
        $entry = $this->entry;
        $params = [];

        $subtype = $this->entry->getSubtype();
Severity: Major
Found in includes/logging/DeleteLogFormatter.php - About 2 hrs to fix

    Method makeLikeArray has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function makeLikeArray( $filterEntry, $protocol = 'http://' ) {
            $services = MediaWikiServices::getInstance();
            $db = $services->getConnectionProvider()->getReplicaDatabase();
            $likeDomain = [];
            $likePath = [];
    Severity: Major
    Found in includes/ExternalLinks/LinkFilter.php - About 2 hrs to fix

      Method finalSetup has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function finalSetup( SettingsBuilder $settingsBuilder ) {
              $config = $settingsBuilder->getConfig();
              $overrides = [];
              $overrides['DBadminuser'] = $config->get( MainConfigNames::DBadminuser );
              $overrides['DBadminpassword'] = $config->get( MainConfigNames::DBadminpassword );
      Severity: Major
      Found in maintenance/includes/Maintenance.php - About 2 hrs to fix

        Method commit has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function commit() {
                $originalCount = count( $this->texts );
                if ( !$originalCount ) {
                    return;
                }
        Severity: Major
        Found in maintenance/storage/recompressTracked.php - About 2 hrs to fix

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

              public function execute() {
                  $force = $this->getOption( 'force' );
                  $startFrom = $this->getOption( 'start-from' );
          
                  // We need the namespace index instead of the name to perform the query
          Severity: Major
          Found in maintenance/prewarmParsoidParserCache.php - About 2 hrs to fix

            File Context.php has 261 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: Minor
            Found in includes/ResourceLoader/Context.php - About 2 hrs to fix

              File EmailUser.php has 261 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: Minor
              Found in includes/mail/EmailUser.php - About 2 hrs to fix

                File CoreMagicVariables.php has 261 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /**
                 * Magic variable implementations provided by MediaWiki core
                 *
                 * This program is free software; you can redistribute it and/or modify
                Severity: Minor
                Found in includes/parser/CoreMagicVariables.php - About 2 hrs to fix

                  File MessagesOc.php has 261 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /** Occitan (occitan)
                   *
                   * @file
                   * @ingroup Languages
                  Severity: Minor
                  Found in languages/messages/MessagesOc.php - About 2 hrs to fix

                    Function _sfc_render$h has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
                      const _component_cdx_icon = resolveComponent("cdx-icon");
                      const _component_cdx_button = resolveComponent("cdx-button");
                      return openBlock(), createBlock(Teleport, {
                        to: _ctx.computedTarget,
                    Severity: Minor
                    Found in resources/lib/codex/codex.js - About 2 hrs 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 checkUserConfigPermissions has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function checkUserConfigPermissions(
                            $action,
                            UserIdentity $user,
                            PermissionStatus $status,
                            $rigor,
                    Severity: Minor
                    Found in includes/Permissions/PermissionManager.php - About 2 hrs 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 getApplicableBlock has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getApplicableBlock(
                            string $action,
                            User $user,
                            string $rigor,
                            $page,
                    Severity: Minor
                    Found in includes/Permissions/PermissionManager.php - About 2 hrs 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 moveToInternal has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function moveToInternal(
                            UserIdentity $user,
                            &$nt,
                            $reason = '',
                            $createRedirect = true,
                    Severity: Minor
                    Found in includes/page/MovePage.php - About 2 hrs 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 updateRecentChange has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function updateRecentChange(
                            IDatabase $dbw,
                            RevisionRecord $current,
                            RevisionRecord $target
                        ) {
                    Severity: Minor
                    Found in includes/page/RollbackPage.php - About 2 hrs 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 isValidMove has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function isValidMove() {
                            $status = new Status();
                    
                            if ( $this->oldTitle->equals( $this->newTitle ) ) {
                                $status->fatal( 'selfmove' );
                    Severity: Minor
                    Found in includes/page/MovePage.php - About 2 hrs 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 expandPackageFiles has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function expandPackageFiles( Context $context ) {
                            $hash = $context->getHash();
                            if ( isset( $this->expandedPackageFiles[$hash] ) ) {
                                return $this->expandedPackageFiles[$hash];
                            }
                    Severity: Minor
                    Found in includes/ResourceLoader/FileModule.php - About 2 hrs 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 getRequirements has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getRequirements( array $info, $includeDev ) {
                            // Quick shortcuts
                            if ( !$includeDev || !isset( $info['dev-requires'] ) ) {
                                return $info['requires'] ?? [];
                            }
                    Severity: Minor
                    Found in includes/registration/ExtensionProcessor.php - About 2 hrs 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 showDiff has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function showDiff() {
                            $oldtitlemsg = 'currentrev';
                            # if message does not exist, show diff against the preloaded default
                            if ( $this->mTitle->getNamespace() === NS_MEDIAWIKI && !$this->mTitle->exists() ) {
                                $oldtext = $this->mTitle->getDefaultMessageText();
                    Severity: Minor
                    Found in includes/editpage/EditPage.php - About 2 hrs 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 constructSlotRecords has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function constructSlotRecords(
                            $revId,
                            $slotRows,
                            $queryFlags,
                            PageIdentity $page,
                    Severity: Minor
                    Found in includes/Revision/RevisionStore.php - About 2 hrs 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 buildLocationRing has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function buildLocationRing( array $weightByLocation ) {
                            $locationCount = count( $weightByLocation );
                            $totalWeight = array_sum( $weightByLocation );
                    
                            $ring = [];
                    Severity: Minor
                    Found in includes/libs/HashRing.php - About 2 hrs 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