wikimedia/mediawiki-core

View on GitHub
includes/MediaWikiEntryPoint.php

Summary

Maintainability
F
4 days
Test Coverage

File MediaWikiEntryPoint.php has 623 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/MediaWikiEntryPoint.php - About 1 day to fix

    MediaWikiEntryPoint has 63 functions (exceeds 20 allowed). Consider refactoring.
    Open

    abstract class MediaWikiEntryPoint {
        use ProtectedHookAccessorTrait;
    
        private IContextSource $context;
        private Config $config;
    Severity: Major
    Found in includes/MediaWikiEntryPoint.php - About 1 day to fix

      Function commitMainTransaction has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function commitMainTransaction() {
              $context = $this->context;
      
              $config = $context->getConfig();
              $request = $context->getRequest();
      Severity: Minor
      Found in includes/MediaWikiEntryPoint.php - About 3 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

      Method commitMainTransaction has 85 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function commitMainTransaction() {
              $context = $this->context;
      
              $config = $context->getConfig();
              $request = $context->getRequest();
      Severity: Major
      Found in includes/MediaWikiEntryPoint.php - About 3 hrs to fix

        Method triggerAsyncJobs has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function triggerAsyncJobs( $n, LoggerInterface $runJobsLogger ) {
                // Do not send request if there are probably no jobs
                $group = $this->getJobQueueGroupFactory()->makeJobQueueGroup();
                if ( !$group->queuesHaveJobs( JobQueueGroup::TYPE_DEFAULT ) ) {
                    return true;
        Severity: Major
        Found in includes/MediaWikiEntryPoint.php - About 2 hrs to fix

          Method outputResponsePayload has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function outputResponsePayload( $content ) {
                  // Append any visible profiling data in a manner appropriate for the Content-Type
                  $this->startOutputBuffer();
                  try {
                      Profiler::instance()->logDataPageOutputOnly();
          Severity: Minor
          Found in includes/MediaWikiEntryPoint.php - About 1 hr to fix

            Function outputResponsePayload has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function outputResponsePayload( $content ) {
                    // Append any visible profiling data in a manner appropriate for the Content-Type
                    $this->startOutputBuffer();
                    try {
                        Profiler::instance()->logDataPageOutputOnly();
            Severity: Minor
            Found in includes/MediaWikiEntryPoint.php - About 1 hr 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 schedulePostSendJobs has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function schedulePostSendJobs() {
                    $jobRunRate = $this->config->get( MainConfigNames::JobRunRate );
                    if (
                        // Post-send job running disabled
                        $jobRunRate <= 0 ||
            Severity: Minor
            Found in includes/MediaWikiEntryPoint.php - About 1 hr to fix

              Function schedulePostSendJobs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function schedulePostSendJobs() {
                      $jobRunRate = $this->config->get( MainConfigNames::JobRunRate );
                      if (
                          // Post-send job running disabled
                          $jobRunRate <= 0 ||
              Severity: Minor
              Found in includes/MediaWikiEntryPoint.php - About 1 hr 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 doPostOutputShutdown has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function doPostOutputShutdown() {
                      // Record backend request timing
                      $timing = $this->context->getTiming();
                      $timing->mark( 'requestShutdown' );
              
              
              Severity: Minor
              Found in includes/MediaWikiEntryPoint.php - About 1 hr to fix

                Function triggerAsyncJobs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function triggerAsyncJobs( $n, LoggerInterface $runJobsLogger ) {
                        // Do not send request if there are probably no jobs
                        $group = $this->getJobQueueGroupFactory()->makeJobQueueGroup();
                        if ( !$group->queuesHaveJobs( JobQueueGroup::TYPE_DEFAULT ) ) {
                            return true;
                Severity: Minor
                Found in includes/MediaWikiEntryPoint.php - About 55 mins 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 flushOutputBuffer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function flushOutputBuffer(): void {
                        // NOTE: Use a for-loop, so we don't loop indefinitely in case
                        // we fail to delete a buffer. This will routinely happen for
                        // PHP's zlib.compression buffer.
                        // See https://www.php.net/manual/en/function.ob-end-flush.php#103387
                Severity: Minor
                Found in includes/MediaWikiEntryPoint.php - About 55 mins 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 shouldDoHttpRedirect has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function shouldDoHttpRedirect() {
                        $request = $this->context->getRequest();
                
                        // Don't redirect if we're already on HTTPS
                        if ( $request->getProtocol() !== 'http' ) {
                Severity: Minor
                Found in includes/MediaWikiEntryPoint.php - About 25 mins 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

                There are no issues that match your filters.

                Category
                Status