Showing 1,432 of 2,096 total issues
Function loadEntity
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function loadEntity( array $requestParams, ?EntityId $entityId = null, $assignFreshId = self::ASSIGN_FRESH_ID ): EntityDocument {
if ( !in_array( $assignFreshId, [ self::ASSIGN_FRESH_ID, self::NO_FRESH_ID ] ) ) {
throw new InvalidArgumentException(
'$assignFreshId must be either of the EntitySavingHelper::ASSIGN_FRESH_ID/NO_FRESH_ID constants.'
);
- 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 resolveTermInLangIds
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function resolveTermInLangIds(
array $termInLangIds,
array $types = null,
array $languages = null
): 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 getLocalizedYear
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private function getLocalizedYear( $isoTimestamp, $precision ) {
preg_match( '/^(\D*)(\d*)/', $isoTimestamp, $matches );
[ , $sign, $year ] = $matches;
$isBCE = $sign === '-';
- 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 getFormatter
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
protected function getFormatter( $dataValueType, $dataTypeId = null ): ValueFormatter {
$formatter = null;
if ( $dataTypeId !== null ) {
if ( isset( $this->formatters["PT:$dataTypeId"] ) ) {
- 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 modifyUsingUnflattenedCallbacks
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private function modifyUsingUnflattenedCallbacks( &$value, array $modifications ): void {
$rootModifications = $modifications[''] ?? [];
unset( $modifications[''] );
if ( is_array( $value ) ) {
- 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 OutputPageBeforeHTMLHookHandler.php
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace Wikibase\Repo\Hooks;
Function show
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
show: function() {
var title = this.getTitle();
if (title && this.enabled) {
var $tip = this.tip();
Function show
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
show: function() {
var title = this.getTitle();
if (title && this.enabled) {
var $tip = this.tip();
Method getDefaultTermsLanguages
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getDefaultTermsLanguages( LanguageNameUtils $languageNameUtils = null ) {
// Note: this list is also the basis of getDefaultMonolingualTextLanguages(); custom
// (non-MediaWikiContentLanguages) terms languages also become monolingual text languages.
return new UnionContentLanguages(
new MediaWikiContentLanguages( $languageNameUtils ),
Function initBridge
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public initBridge(
information: AppInformation,
): Promise<void> {
this.commit( 'setEditFlow', information.editFlow );
this.commit( 'setPropertyPointer', information.propertyId );
CachingPrefetchingTermLookup
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
final class CachingPrefetchingTermLookup implements PrefetchingTermLookup {
use TermCacheKeyBuilder;
private const DEFAULT_TTL = 60;
Function _attachInputEventHandlers
has 66 lines of code (exceeds 25 allowed). Consider refactoring. Open
_attachInputEventHandlers: function () {
var self = this,
suppressKeyPress = false;
this.element
File ModifyEntity.php
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace Wikibase\Repo\Api;
File RdfVocabulary.php
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Wikibase\Repo\Rdf;
use DataValues\DataValue;
Method assertValidStatements
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function assertValidStatements(
array $statementsSerialization,
Property $originalProperty,
array $originalStatementsSerialization
): void {
Method showUndoForm
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function showUndoForm(): void {
$this->getOutput()->enableOOUI();
$req = $this->getRequest();
if ( $this->showPermissionError( 'read' ) || $this->showPermissionError( 'edit' ) ) {
Method execute
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function execute() {
if ( !WikibaseSettings::isRepoEnabled() ) {
$this->fatalError( "You need to have Wikibase enabled in order to use this maintenance script!" );
}
$format = $this->getOption( 'format', 'json' );
File ParseValue.php
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace Wikibase\Repo\Api;
File FormatSnakValue.php
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare( strict_types = 1 );
namespace Wikibase\Repo\Api;
Function draw
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
draw: function () {
var done = $.Deferred().resolve().promise();
var self = this,
languageCode = this.options.value.getLanguageCode(),
descriptionText = this.options.value.getText();