Showing 1,432 of 2,096 total issues
Method assertValidStatements
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function assertValidStatements( array $serialization, Item $originalItem, array $originalStatementsSerialization ): void {
$validationError = $this->statementsValidator->validateModifiedStatements(
$originalStatementsSerialization,
$originalItem->getStatements(),
$serialization['statements'] ?? [],
File jquery.wikibase.badgeselector.js
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* @license GPL-2.0-or-later
* @author H. Snater < mediawiki@snater.com >
*/
( function () {
RdfBuilder
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class RdfBuilder implements EntityRdfBuilder, EntityStubRdfBuilder, EntityMentionListener {
/**
* A list of entities mentioned/touched to or by this builder.
* The prefixed entity IDs are used as keys in the array, the value 'true'
EntityContent
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
abstract class EntityContent extends AbstractContent {
/**
* Flag for use with EntityHandler::validateSave(), indicating that no pre-save validation should be applied.
* Can be passed in via EditEntity::attemptSave, EntityStore::saveEntity,
WikibaseValueFormatterBuilders
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class WikibaseValueFormatterBuilders {
/**
* @var FormatterLabelDescriptionLookupFactory
*/
StatementList
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class StatementList implements IteratorAggregate, Countable {
/**
* @var Statement[]
*/
Fingerprint
has 23 functions (exceeds 20 allowed). Consider refactoring. Open
class Fingerprint implements LabelsProvider, DescriptionsProvider, AliasesProvider {
/**
* @deprecated since 2.5, use new Fingerprint() instead.
*
Method mergeChanges
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function mergeChanges( EntityId $entityId, array $changes ) {
if ( count( $changes ) === 1 ) {
return reset( $changes );
}
Method getEntityRevision
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getEntityRevision( EntityId $id, $revision, $allowRedirects = false ) {
$prefixedId = $id->getSerialization();
$redirectRevision = null;
try {
Function draw
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
draw: function () {
var self = this,
deferred = $.Deferred(),
languageCode = this.options.value.getLanguageCode(),
labelText = this.options.value.getText();
Method internalDoHtmlPageLinkRendererEnd
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function internalDoHtmlPageLinkRendererEnd(
LinkRenderer $linkRenderer,
Title $target,
&$text,
array &$customAttribs,
Function createServices
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function createServices(
mwWindow: MwWindow,
editTags: readonly string[],
eventTracker: Tracker,
): ServiceContainer {
File EntitySavingHelper.php
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace Wikibase\Repo\Api;
Function formatResult
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function formatResult(
IResultWrapper $res,
int $limit,
array $prop,
?ApiPageSet $resultPageSet
- 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 formatResult
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function formatResult( IResultWrapper $res, int $limit, array $prop ): void {
$currentPageId = null;
$entry = [];
$count = 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
Function buildTermSearchMatchPageEntry
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private function buildTermSearchMatchPageEntry( TermSearchResult $match, ?array $props ): array {
$entityId = $match->getEntityId();
if ( $entityId !== null ) {
$entry = [
'id' => $entityId->getSerialization(),
- 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 attemptSave
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function attemptSave( EntityDocument $newEntity, string $summary, $flags, $token, $watch = null, array $tags = [] ) {
$this->checkReadOnly( $newEntity ); // throws, exception formatted by MediaWiki (cf. MWExceptionRenderer::getExceptionTitle)
$this->checkEntityId( $newEntity->getId() ); // throws internal error (unexpected condition)
$watch = $this->getDesiredWatchState( $watch );
- 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 _initTagEvents
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
_initTagEvents: function ( $tag ) {
var self = this,
$input = $tag.find( 'input' );
$input
Method onLoadExtensionSchemaUpdates
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function onLoadExtensionSchemaUpdates( $updater ) {
$db = $updater->getDB();
$type = $db->getType();
if ( $type !== 'mysql' && $type !== 'sqlite' && $type !== 'postgres' ) {
Method handleRequest
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function handleRequest( $doc, WebRequest $request, OutputPage $output ) {
// No matter what: The response is always public
$output->getRequest()->response()->header( 'Access-Control-Allow-Origin: *' );
$revision = 0;