File Hooks.php
has 420 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace CirrusSearch;
use CirrusSearch\Search\FancyTitleResultsType;
Hooks
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
class Hooks implements
UserGetDefaultOptionsHook,
GetPreferencesHook,
APIAfterExecuteHook,
ApiBeforeMainHook,
Function overrideMoreLikeThisOptionsFromMessage
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private static function overrideMoreLikeThisOptionsFromMessage() {
global $wgCirrusSearchMoreLikeThisConfig,
$wgCirrusSearchMoreLikeThisAllowedFields,
$wgCirrusSearchMoreLikeThisMaxQueryTermsLimit,
$wgCirrusSearchMoreLikeThisFields;
- 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 overrideMoreLikeThisOptionsFromMessage
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static function overrideMoreLikeThisOptionsFromMessage() {
global $wgCirrusSearchMoreLikeThisConfig,
$wgCirrusSearchMoreLikeThisAllowedFields,
$wgCirrusSearchMoreLikeThisMaxQueryTermsLimit,
$wgCirrusSearchMoreLikeThisFields;
Method handleSearchGetNearMatch
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function handleSearchGetNearMatch( $term, &$titleResult ) {
global $wgSearchType;
if ( $wgSearchType !== 'CirrusSearch' ) {
return true;
}
Method initializeForRequest
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function initializeForRequest( WebRequest $request ) {
global $wgCirrusSearchPhraseRescoreWindowSize,
$wgCirrusSearchFunctionRescoreWindowSize,
$wgCirrusSearchFragmentSize,
$wgCirrusSearchPhraseRescoreBoost,
Method onShowSearchHitTitle
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
public function onShowSearchHitTitle( &$title, &$text, $result, $terms, $page, &$query, &$attributes ) {
Method onBeforeInitialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function onBeforeInitialize( $title, $unused, $outputPage, $user, $request, $mediaWiki ) {
Method overrideSecret
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
private static function overrideSecret( &$dest, $secret, WebRequest $request, $name, $value = true ) {
Method overrideNumeric
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
&$dest,
WebRequest $request,
$name,
$limit = null,
$upperLimit = true
Avoid too many return
statements within this method. Open
return true;
Function handleSearchGetNearMatch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function handleSearchGetNearMatch( $term, &$titleResult ) {
global $wgSearchType;
if ( $wgSearchType !== 'CirrusSearch' ) {
return true;
}
- 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 prefixSearchExtractNamespaceWithConnection
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function prefixSearchExtractNamespaceWithConnection(
Connection $connection,
&$namespaces,
&$search
) {
- 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"