Showing 2,096 of 2,096 total issues
Function validateFormData
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function validateFormData( array $formData ) {
$status = Status::newGood();
if ( $formData[ self::FIELD_LABEL ] == ''
&& $formData[ self::FIELD_DESCRIPTION ] == ''
- 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 onSkinTemplateNavigationUniversal
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function onSkinTemplateNavigationUniversal( SkinTemplate $skinTemplate, array &$links ) {
$entityContentFactory = WikibaseRepo::getEntityContentFactory();
$title = $skinTemplate->getRelevantTitle();
- 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 validateEntity
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function validateEntity( EntityDocument $entity ) {
$entityId = $entity->getId()->getSerialization();
$entityType = $entity->getType();
if ( $entity instanceof LabelsProvider ) {
- 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 reduceUnits
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function reduceUnits( $reconvert, &$convertUnits ) {
while ( $reconvert ) {
$converted = false;
foreach ( $reconvert as $name => $unit ) {
$convertedUnit = $this->convertDerivedUnit( $unit, $convertUnits );
- 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 buildClaimSummary
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function buildClaimSummary( ?Statement $oldStatement, Statement $newStatement ) {
$summary = new Summary( $this->apiModuleName );
// Only one statement touched, so we're always having singular here.
$summary->addAutoCommentArgs( 1 );
$summary->addAutoSummaryArgs( [
- 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 execute
has a Cognitive Complexity of 12 (exceeds 5 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!\n" );
}
- 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 loadLatestRevisionIds
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function loadLatestRevisionIds( array $entityIds, $mode ) {
$this->doFetch( $mode );
$revisionIds = [];
- 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 getDataTypeIdForProperty
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getDataTypeIdForProperty( PropertyId $propertyId ) {
$dataTypeId = null;
$info = $this->infoLookup->getPropertyInfo( $propertyId );
if ( $info !== null && isset( $info[PropertyInfoLookup::KEY_DATA_TYPE] ) ) {
- 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 mapToTextInLangIds
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function mapToTextInLangIds(
array $termsArray,
ReplicaPrimaryAwareRecordIdsAcquirer $textInLangIdsAcquirer
) {
$flattenedLangTextIds = [];
- 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 mergeComplexArrays
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private static function mergeComplexArrays(
string $key,
array $value,
array $defaultValue,
array $twoDArrayMerge,
- 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 factory
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function factory( $language, $sourceLanguage = null ) {
if ( is_string( $language ) ) {
$languageCode = self::validateLanguageCode( $language );
} else {
$languageCode = $language->getCode();
- 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 assertNoDuplicateSourcesOrEntityTypes
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function assertNoDuplicateSourcesOrEntityTypes( array $sources ) {
$entityTypesProvided = [];
$sourceNamesProvided = [];
foreach ( $sources as $source ) {
- 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 trackChanges
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public trackChanges( oldStatement: Statement|null, newStatement: Statement ): void {
if ( oldStatement === null ) {
// newly created statement
return;
}
- 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 trimStatementMap
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private trimStatementMap( newStatementMap: StatementMap, baseStatementMap: StatementMap ): StatementMap {
const trimmedStatementMap: StatementMap = {};
const propertyIds = new Set( [ ...Object.keys( newStatementMap ), ...Object.keys( baseStatementMap ) ] );
for ( const propertyId of propertyIds ) {
if ( propertyId in baseStatementMap ) {
- 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 movePropertyGroup
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private function movePropertyGroup( PropertyId $propertyId, $toIndex ) {
if ( $this->getPropertyGroupIndex( $propertyId ) === $toIndex ) {
return;
}
- 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 createTag
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
createTag: function ( value, additionalClasses, forceTextInput ) {
value = this._formatLabel( value );
var $tag = this.getTag( value );
Function WbSites
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
wb.sites = new ( function WbSites() {
/**
* Will hold a list of all the sites after getSites() was called. This will cache the result.
*
Function WbSites
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
var wbSites = new ( function WbSites() {
/**
* Will hold a list of all the sites after getSites() was called. This will cache the result.
*
Method getAllowedParams
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getAllowedParams(): array {
return [
'prop' => [
ParamValidator::PARAM_ISMULTI => true,
ParamValidator::PARAM_TYPE => [
Method newLanguageIndependentLuaBindings
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function newLanguageIndependentLuaBindings(): WikibaseLanguageIndependentLuaBindings {
$mediaWikiServices = MediaWikiServices::getInstance();
$settings = WikibaseClient::getSettings( $mediaWikiServices );
$store = WikibaseClient::getStore( $mediaWikiServices );
$termsLanguages = WikibaseClient::getTermsLanguages( $mediaWikiServices );