wikimedia/mediawiki-core

View on GitHub
includes/logging/LogEventsList.php

Summary

Maintainability
F
4 days
Test Coverage

File LogEventsList.php has 502 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Contain classes to list log entries
 *
 * Copyright © 2004 Brooke Vibber <bvibber@wikimedia.org>
Severity: Major
Found in includes/logging/LogEventsList.php - About 1 day to fix

    Method showLogExtract has 144 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function showLogExtract(
            &$out, $types = [], $page = '', $user = '', $param = []
        ) {
            $defaultParameters = [
                'lim' => 25,
    Severity: Major
    Found in includes/logging/LogEventsList.php - About 5 hrs to fix

      Function showLogExtract has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function showLogExtract(
              &$out, $types = [], $page = '', $user = '', $param = []
          ) {
              $defaultParameters = [
                  'lim' => 25,
      Severity: Minor
      Found in includes/logging/LogEventsList.php - About 5 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 getShowHideLinks has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          private function getShowHideLinks( $row ) {
              // We don't want to see the links and
              if ( $this->flags == self::NO_ACTION_LINK ) {
                  return '';
              }
      Severity: Minor
      Found in includes/logging/LogEventsList.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 showOptions has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function showOptions( $type = '', $year = 0, $month = 0, $day = 0 ) {
              $formDescriptor = [];
      
              // Basic selectors
              $formDescriptor['type'] = $this->getTypeMenuDesc();
      Severity: Major
      Found in includes/logging/LogEventsList.php - About 2 hrs to fix

        Method logLine has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function logLine( $row ) {
                $entry = DatabaseLogEntry::newFromRow( $row );
                $formatter = LogFormatter::newFromEntry( $entry );
                $formatter->setContext( $this->getContext() );
                $formatter->setLinkRenderer( $this->getLinkRenderer() );
        Severity: Major
        Found in includes/logging/LogEventsList.php - About 2 hrs to fix

          Method getShowHideLinks has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function getShowHideLinks( $row ) {
                  // We don't want to see the links and
                  if ( $this->flags == self::NO_ACTION_LINK ) {
                      return '';
                  }
          Severity: Major
          Found in includes/logging/LogEventsList.php - About 2 hrs to fix

            Method getTypeMenuDesc has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function getTypeMenuDesc() {
                    $typesByName = [];
                    // Load the log names
                    foreach ( LogPage::validTypes() as $type ) {
                        $page = new LogPage( $type );
            Severity: Minor
            Found in includes/logging/LogEventsList.php - About 1 hr to fix

              Function getExcludeClause has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function getExcludeClause( $db, $audience = 'public', Authority $performer = null ) {
                      $logRestrictions = MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::LogRestrictions );
              
                      if ( $audience != 'public' && $performer === null ) {
                          throw new InvalidArgumentException(
              Severity: Minor
              Found in includes/logging/LogEventsList.php - About 45 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

              Method showLogExtract has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      &$out, $types = [], $page = '', $user = '', $param = []
              Severity: Minor
              Found in includes/logging/LogEventsList.php - About 35 mins to fix

                Function showOptions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function showOptions( $type = '', $year = 0, $month = 0, $day = 0 ) {
                        $formDescriptor = [];
                
                        // Basic selectors
                        $formDescriptor['type'] = $this->getTypeMenuDesc();
                Severity: Minor
                Found in includes/logging/LogEventsList.php - About 35 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 getTypeMenuDesc has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function getTypeMenuDesc() {
                        $typesByName = [];
                        // Load the log names
                        foreach ( LogPage::validTypes() as $type ) {
                            $page = new LogPage( $type );
                Severity: Minor
                Found in includes/logging/LogEventsList.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