Showing 718 of 718 total issues
Method __construct
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct() {
parent::__construct();
$this->addDescription( "Force indexing some pages. Setting --from or --to will switch "
. "from page id based indexing to "
. "date based indexing which uses less efficient queries and follows redirects.\n\n"
Method execute
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
global $wgLanguageCode,
$wgCirrusSearchBannedPlugins,
$wgCirrusSearchMasterTimeout;
Method truncateField
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function truncateField( string $field, bool $keyword, int $minFieldLength, int $maxDocSize, string $statBucket ): void {
if ( !$this->document->has( $field ) ) {
return;
}
$fieldData = $this->document->get( $field );
File MetaStoreIndex.php
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace CirrusSearch\MetaStore;
use CirrusSearch\Connection;
SearchQuery
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class SearchQuery {
/**
* Identifier for the fulltext SearchEngine entry point
* @see \SearchEngine::searchText()
*/
Util
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Util {
/**
* Cache getDefaultBoostTemplates()
*
* @var array|null boost templates
Method getImplementation
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getImplementation( $func ) {
$weight = $func['weight'] ?? 1;
$config = $this->context->getConfig();
switch ( $func['type'] ) {
case 'boostlinks':
Method overrideMoreLikeThisOptionsFromMessage
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function overrideMoreLikeThisOptionsFromMessage() {
global $wgCirrusSearchMoreLikeThisConfig,
$wgCirrusSearchMoreLikeThisAllowedFields,
$wgCirrusSearchMoreLikeThisMaxQueryTermsLimit,
$wgCirrusSearchMoreLikeThisFields;
Method buildExpQuery
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function buildExpQuery( $queryString ) {
$query = new \Elastica\Query\BoolQuery();
$query->setMinimumShouldMatch( 0 );
$this->attachFilter( $this->filter, $queryString, $query );
$dismaxQueries = [];
Method build
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function build( $inputDocs, $explain = false ) {
$titleFactory = MediaWikiServices::getInstance()->getTitleFactory();
// Cross namespace titles
$crossNsTitles = [];
$docs = [];
Method parse
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parse( string $query, int $start, int $end ) {
$match = [];
Assert::precondition( $start < $end, '$start < $end' );
Assert::precondition( $end <= strlen( $query ), '$end <= strlen( $query )' );
$ret = preg_match( self::NEGATION, $query, $match, PREG_OFFSET_CAPTURE, $start );
Function loadConfigFromAPI
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function loadConfigFromAPI( $wikis, array $hashConfigFlags, $fallbackConfig ) {
$endpoints = [];
foreach ( $wikis as $prefix => $wiki ) {
$iw = $this->interwikiLookup->fetch( $prefix );
if ( !$iw || !$this->useConfigDumpApi || !$iw->isLocal() ) {
- 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 buildTagWeightsFromLegacyParameters
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public static function buildTagWeightsFromLegacyParameters( $tagNames = null, $tagWeights = null ) {
Assert::parameterType(
[
'string',
'array',
- 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 getOverriddenFactor
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
protected function getOverriddenFactor( $value ) {
if ( is_array( $value ) ) {
$returnValue = (float)$value['value'];
if ( isset( $value['config_override'] ) ) {
- 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 __construct
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( SearchConfig $config, $weight, $profile ) {
parent::__construct( $config, $weight );
if ( isset( $profile['impact'] ) ) {
$this->impact = $this->getOverriddenFactor( $profile['impact'] );
- 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 getSupportedProfile
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private function getSupportedProfile( $profileName ) {
$profile = $this->context->getConfig()
->getProfileService()
->loadProfileByName( SearchProfileService::RESCORE, $profileName );
if ( !is_array( $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 explain
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def explain(
self,
problem: Problem,
es_state: Mapping[Tuple[str, str], ElasticsearchState],
) -> Optional[str]:
- 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 17 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$this->disablePoolCountersAndLogging();
$this->indexSuffix = $this->getBackCompatOption( 'indexSuffix', 'indexType' );
$this->indexBaseName = $this->getOption( 'baseName',
- 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 recycle
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function recycle() {
$this->log( "Recycling index {$this->getIndex()->getName()}\n" );
$this->recycle = true;
$indexedDocs = $this->indexData();
// This is fragile... hopefully most of the docs will be deleted from the old segments
Method __construct
has 17 arguments (exceeds 4 allowed). Consider refactoring. Open
ParsedQuery $parsedQuery,
array $initialNamespaces,
CrossSearchStrategy $initialCrosswikiStrategy,
array $contextualFilters,
$searchEngineEntryPoint,