Method buildCirrusSearchRequestEvent
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function buildCirrusSearchRequestEvent() {
global $wgRequest, $wgServerName;
$webrequest = $wgRequest;
// for the moment RequestLog::getRequests() is still created in the
Function buildCirrusSearchRequestEvent
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
private function buildCirrusSearchRequestEvent() {
global $wgRequest, $wgServerName;
$webrequest = $wgRequest;
// for the moment RequestLog::getRequests() is still created in the
- 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
File RequestLogger.php
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace CirrusSearch;
use ISearchResultSet;
Function addRequest
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function addRequest( RequestLog $log, UserIdentity $user = null, $slowMillis = null ) {
global $wgCirrusSearchLogElasticRequests;
// @todo Is this necessary here? Check on what uses the response value
$finalContext = $log->getLogVariables() + [
- 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 buildLogMessage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function buildLogMessage( RequestLog $log, array $context ) {
$message = $log->getDescription();
$message .= " against {index} took {tookMs} millis";
if ( isset( $context['elasticTookMs'] ) ) {
$message .= " and {elasticTookMs} Elasticsearch millis";
- 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
Avoid too many return
statements within this method. Open
return $requestEvent;