File MWDebug.php
has 405 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
Function debugMsg
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public static function debugMsg( $str, $context = [] ) {
global $wgDebugComments, $wgShowDebug;
if ( self::$enabled || $wgDebugComments || $wgShowDebug ) {
if ( $context ) {
- Read upRead up
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
MWDebug
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
class MWDebug {
/**
* Log lines
*
* @var array
Method debugMsg
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function debugMsg( $str, $context = [] ) {
global $wgDebugComments, $wgShowDebug;
if ( self::$enabled || $wgDebugComments || $wgShowDebug ) {
if ( $context ) {
Function deprecatedMsg
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function deprecatedMsg( $msg, $version = false,
$component = false, $callerOffset = 2
) {
if ( $callerOffset === false ) {
$callerFunc = '';
- Read upRead up
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 deprecatedMsg
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function deprecatedMsg( $msg, $version = false,
$component = false, $callerOffset = 2
) {
if ( $callerOffset === false ) {
$callerFunc = '';
Function getCallerDescription
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private static function getCallerDescription( $callerOffset ) {
$callers = wfDebugBacktrace();
if ( isset( $callers[$callerOffset] ) ) {
$callerfile = $callers[$callerOffset];
- Read upRead up
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 getDebugInfo
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getDebugInfo( IContextSource $context ) {
if ( !self::$enabled ) {
return [];
}
Method query
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function query( $sql, $function, $runTime, $dbhost ) {
if ( !self::$enabled ) {
return false;
}
Method detectDeprecatedOverride
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function detectDeprecatedOverride( $instance, $class, $method, $version = false,
$component = false, $callerOffset = 2
Function appendDebugInfoToApiResult
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function appendDebugInfoToApiResult( IContextSource $context, ApiResult $result ) {
if ( !self::$enabled ) {
return;
}
- Read upRead up
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 sendRawDeprecated
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function sendRawDeprecated( $msg, $sendToLog = true, $callerFunc = '' ) {
foreach ( self::$deprecationFilters as $filter => $callback ) {
if ( preg_match( $filter, $msg ) ) {
if ( is_callable( $callback ) ) {
$callback();
- Read upRead up
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"