Showing 2,096 of 2,096 total issues
Function validateParameters
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function validateParameters( array $params ): void {
$entityReferenceBySiteLinkGiven = isset( $params['site'] ) && isset( $params['title'] );
$entityReferenceBySiteLinkPartial = ( isset( $params['site'] ) xor isset( $params['title'] ) );
$entityIdGiven = isset( $params['id'] );
$shouldCreateNewWithSomeType = isset( $params['new'] );
- 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 onArticleDeleteComplete
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
WikiPage $wikiPage,
User $user,
$reason,
$id,
?Content $content,
Method onFormat
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function onFormat( &$comment, $pre, $auto, $post, $title, $local ) {
Method getRankedSearchResults
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$text,
$languageCode,
$entityType,
$limit,
$strictLanguage,
Method getRankedSearchResults
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$text,
$languageCode,
$entityType,
$limit,
$strictLanguage,
Method getRankedSearchResults
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$text,
$languageCode,
$entityType,
$limit,
$strictLanguage,
Method onHtmlPageLinkRendererEnd
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$linkRenderer,
$target,
$isKnown,
&$text,
&$extraAttribs,
Method getRankedSearchResults
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$text,
$languageCode,
$entityType,
$limit,
$strictLanguage,
Method getRankedSearchResults
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$text,
$languageCode,
$entityType,
$limit,
$strictLanguage,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
ApiMain $mainModule,
string $moduleName,
ItemMergeInteractor $interactor,
ApiErrorReporter $errorReporter,
callable $resultBuilderInstantiator,
Method getRankedSearchResults
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$text,
$languageCode,
$entityType,
$limit,
$strictLanguage,
Function onRevisionFromEditComplete
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function onRevisionFromEditComplete(
WikiPage $wikiPage,
RevisionRecord $revisionRecord,
$baseID,
UserIdentity $user
- 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 __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$maxLength,
array $languageCodes,
EntityIdParser $idParser,
TermsCollisionDetectorFactory $termsCollisionDetectorFactory,
TermLookup $termLookup,
Method factory
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
ApiMain $apiMain,
string $moduleName,
IBufferingStatsdDataFactory $dataFactory,
ApiHelperFactory $apiHelperFactory,
EntityIdFormatterFactory $entityIdFormatterFactory,
Method factory
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
ApiMain $mainModule,
string $moduleName,
ApiHelperFactory $apiHelperFactory,
EntityIdParser $entityIdParser,
StatementGuidParser $statementGuidParser,
Method searchEntities
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
private function searchEntities( $text, $languageCode, $entityType, $limit, $prefixSearch, $strictLanguage ) {
Method addValueNode
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
RdfWriter $writer,
$propertyValueNamespace,
$propertyValueLName,
$dataType,
$snakNamespace,
Method addValue
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
RdfWriter $writer,
$propertyValueNamespace,
$propertyValueLName,
$dataType,
$snakNamespace,
Function validateSiteLinkSerialization
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function validateSiteLinkSerialization( $serialization, $siteCode, SiteList $sites = null ) {
$this->assertArray( $serialization, 'An array was expected, but not found' );
if ( !array_key_exists( 'site', $serialization ) ) {
throw new ChangeOpDeserializationException( 'Site must be provided', 'no-site' );
- 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 addValue
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
RdfWriter $writer,
$propertyValueNamespace,
$propertyValueLName,
$dataType,
$snakNamespace,