Showing 691 of 718 total issues
Method getProfile
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getProfile( $name ) {
$settings = $this->wrapped->getProfile( $name );
if ( $settings === null ) {
return null;
}
Method siteMatrixLoader
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function siteMatrixLoader() {
return function () {
global $wgConf;
$matrix = new SiteMatrix;
Method build
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function build( array $config ): array {
$langStem = "{$this->langName}_stemmer";
if ( $this->unpacked ) {
// Analyzer config for char_filter and filter will be in the order below,
Method expression
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function expression() {
$clauses = [];
$left = null;
// Last boolean operator seen, -1 means none
$lastBoolType = -1;
Method execute
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$this->disablePoolCountersAndLogging();
$wiki = sprintf( "[%20s]", WikiMap::getCurrentWikiId() );
// Make sure we've actually got indices to populate
Function parse
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function parse( $query, KeywordFeature $feature, OffsetTracker $tracker, $startOffset = 0 ) {
if ( $feature->greedy() ) {
Assert::precondition( !$feature->allowEmptyValue(),
"greedy keywords must not accept empty value" );
// XXX: we ignore value delimiter for greedy keywords
- 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 buildExpQuery
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
private function buildExpQuery( $queryString ) {
$query = new \Elastica\Query\BoolQuery();
$query->setMinimumShouldMatch( 0 );
$this->attachFilter( $this->filter, $queryString, $query );
$dismaxQueries = [];
- 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
Hooks
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
class Hooks implements
UserGetDefaultOptionsHook,
GetPreferencesHook,
APIAfterExecuteHook,
ApiBeforeMainHook,
UpdateOneSearchIndexConfig
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
class UpdateOneSearchIndexConfig extends Maintenance {
/**
* @var string
*/
private $indexSuffix;
File Util.php
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace CirrusSearch;
use MediaWiki\Context\RequestContext;
Function updateLinkedArticles
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function updateLinkedArticles( $titles ): void {
$pages = [];
$wikiPageFactory = MediaWikiServices::getInstance()->getWikiPageFactory();
foreach ( $titles as $title ) {
// Special pages don't get updated, we only index
- 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
BaseHighlightedField
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class BaseHighlightedField extends HighlightedField {
public const TYPE = 'highlighting';
public const FVH_HL_TYPE = 'fvh';
File check_indices.py
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Reconcile expected indices against live cluster state
Reconciles the state of multiple elasticsearch clusters against the expected
state of multiple wikis. The reconciliation process is accept based. Some
Function execute
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function execute() {
$result = $this->getResult();
$services = MediaWikiServices::getInstance();
$engine = $services->getSearchEngineFactory()->create();
if ( !( $engine instanceof CirrusSearch ) ) {
- 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 execute
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
$result = $this->getResult();
$services = MediaWikiServices::getInstance();
$engine = $services->getSearchEngineFactory()->create();
if ( !( $engine instanceof CirrusSearch ) ) {
File Updater.php
has 304 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace CirrusSearch;
use CirrusSearch\BuildDocument\BuildDocument;
Method parse
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parse( $query, KeywordFeature $feature, OffsetTracker $tracker, $startOffset = 0 ) {
if ( $feature->greedy() ) {
Assert::precondition( !$feature->allowEmptyValue(),
"greedy keywords must not accept empty value" );
// XXX: we ignore value delimiter for greedy keywords
Function deduplicateAnalysisConfig
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public function deduplicateAnalysisConfig( array $analysis ) {
// Deduplicate children first to normalize analyzer configuration.
foreach ( [ 'tokenizer', 'filter', 'char_filter' ] as $k ) {
if ( !isset( $analysis[$k] ) ) {
continue;
- 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 collectTitlesFromDB
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private function collectTitlesFromDB( $term ) {
$titles = [];
$found = [];
$titleFactory = MediaWikiServices::getInstance()->getTitleFactory();
$wikiPageFactory = MediaWikiServices::getInstance()->getWikiPageFactory();
- 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 SaneitizeJobs.php
has 301 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace CirrusSearch\Maintenance;
use CirrusSearch\Connection;