Showing 691 of 718 total issues
Function validateParams
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
private function validateParams() {
$pageOptionCount = (int)$this->hasOption( 'page' ) + (int)$this->hasOption( 'page-list' )
+ (int)$this->hasOption( 'pageid-list' );
if ( $pageOptionCount !== 1 ) {
$this->fatalError( "Exactly one of --page, --page-list and --pageid-list must be used" );
- 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 build
has 133 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function build( SearchContext $searchContext, $term ) {
$searchContext->addSyntaxUsed( 'full_text' );
// Transform MediaWiki specific syntax to filters and extra
// (pre-escaped) query string
foreach ( $this->features as $feature ) {
Function searchMulti
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
protected function searchMulti( MSearchRequests $msearches ) {
$searches = $msearches->getRequests();
$contextResultsType = $this->searchContext->getResultsType();
$cirrusDebugOptions = $this->searchContext->getDebugOptions();
Assert::precondition( !$cirrusDebugOptions->isCirrusDumpQuery(), 'Must not reach this method when dumping the query' );
- 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 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
Method searchMulti
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function searchMulti( MSearchRequests $msearches ) {
$searches = $msearches->getRequests();
$contextResultsType = $this->searchContext->getResultsType();
$cirrusDebugOptions = $this->searchContext->getDebugOptions();
Assert::precondition( !$cirrusDebugOptions->isCirrusDumpQuery(), 'Must not reach this method when dumping the query' );
Method build
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function build() {
$resultsType = $this->searchContext->getResultsType();
$query = new Query();
$query->setTrackTotalHits( $this->searchContext->getTrackTotalHits() );
Function postProcess
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
public function postProcess( CompletionResultsCollector $collector, ResultSet $results, $indexName ) {
$suggestResp = $results->getSuggests();
if ( $suggestResp === [] ) {
// Edge case where the index contains 0 documents and does not even return the 'suggest' field
return 0;
- 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 sendData
has 120 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function sendData( $indexSuffix, array $documents ) {
if ( !$documents ) {
return Status::newGood();
}
File CirrusSearch.php
has 366 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace CirrusSearch;
use CirrusSearch\Extra\MultiList\MultiListBuilder;
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
Function replace
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
private function replace( array $profile, array $replacement ) {
$cur = &$profile;
foreach ( $replacement['matches'] as $match ) {
if ( !is_array( $cur ) ) {
return $profile;
- 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 sendData
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
public function sendData( $indexSuffix, array $documents ) {
if ( !$documents ) {
return Status::newGood();
}
- 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
AnalyzerBuilder
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
class AnalyzerBuilder {
/**
* Indicate that filters should be automatically appended or prepended, rather
* than inserted before a given filter.
*/
Method getDefaultFields
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getDefaultFields() {
// Note never to set something as type='object' here because that isn't returned by elasticsearch
// and is inferred anyway.
$titleExtraAnalyzers = [
[ 'analyzer' => 'prefix', 'search_analyzer' => 'near_match', 'index_options' => 'docs', 'norms' => false ],
File FullTextQueryStringQueryBuilder.php
has 344 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace CirrusSearch\Query;
use CirrusSearch\Extra\Query\TokenCountRouter;
Function readLineBatch
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
private function readLineBatch( SplFileObject $file, bool $useIds ) {
$titleParser = MediaWikiServices::getInstance()->getTitleParser();
$pageStore = MediaWikiServices::getInstance()->getPageStore();
$linkBatchFactory = MediaWikiServices::getInstance()->getLinkBatchFactory();
$batchSize = $this->getBatchSize();
- 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
Searcher
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
class Searcher extends ElasticsearchIntermediary implements SearcherFactory {
public const SUGGESTION_HIGHLIGHT_PRE = '<em>';
public const SUGGESTION_HIGHLIGHT_POST = '</em>';
public const HIGHLIGHT_PRE_MARKER = ''; // \uE000. Can't be a unicode literal until php7
public const HIGHLIGHT_PRE = '<span class="searchmatch">';
File Reindexer.php
has 338 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace CirrusSearch\Maintenance;
use CirrusSearch\Connection;
Function build
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function build() {
$resultsType = $this->searchContext->getResultsType();
$query = new Query();
$query->setTrackTotalHits( $this->searchContext->getTrackTotalHits() );
- 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 execute
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$this->disablePoolCountersAndLogging();
$wiki = sprintf( "[%20s]", WikiMap::getCurrentWikiId() );
// Make sure we've actually got indices to populate
- 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"