Showing 1,432 of 2,096 total issues
Function getMonthNameUnlocalizer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getMonthNameUnlocalizer() {
$languageCode = $this->options->getOption( ValueParser::OPT_LANG );
if ( $languageCode === self::CANONICAL_LANGUAGE_CODE ) {
$replacements = [];
- 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 applyGlobals
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function applyGlobals() {
$optionsData = $this->getOption( 'options', 'false' );
if ( substr_compare( $optionsData, 'B64://', 0, strlen( 'B64://' ) ) === 0 ) {
$optionsData = base64_decode( substr( $optionsData, strlen( 'B64://' ) ) );
}
- 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 saveEntity
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
EntityDocument $entity,
$summary,
User $user,
$flags = 0,
$baseRevId = false,
Method build
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
OutputPage $out,
$rightsUrl,
$rightsText,
array $badgeItems,
$stringLimit,
Avoid deeply nested control flow statements. Open
if ( isset( $date['second'] ) ) {
$precision = TimeValue::PRECISION_SECOND;
$time[5] = $this->parseFormattedNumber( $date['second'] );
}
Function chooseAndParseNumber
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function chooseAndParseNumber( Language $lang, $matches, $precision, $isBceMsg ) {
$year = null;
foreach ( $matches as $number ) {
if ( $number === '' ) {
continue;
- 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 saveRedirect
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
EntityRedirect $redirect,
$summary,
User $user,
$flags = 0,
$baseRevId = false,
Function getEntity
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getEntity( $expectedClass = EntityDocument::class ) {
if ( !$this->entity ) {
$this->entity = $this->codec->decodeEntity( $this->blob, $this->contentFormat );
if ( !( $this->entity instanceof EntityDocument ) ) {
- 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 attemptSave
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
EntityDocument $newEntity,
string $summary,
$flags,
$token,
$watch = null,
Method attemptSave
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function attemptSave( EntityDocument $newEntity, string $summary, $flags, $token, $watch = null, array $tags = [] ) {
Function getRegexpsFromMessageText
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function getRegexpsFromMessageText( string $msgText ): array {
static $pluralRegex = null;
if ( $pluralRegex === null ) {
// We need to match on a preg_quoted string here, so double quote
$pluralRegex = '@' . preg_quote( preg_quote( '{{PLURAL:$1|' ) ) .
- 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 deserialize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function deserialize( string $dataTypeId, array $valueSerialization, string $basePath = '' ): DataValue {
$this->assertFieldExists( $valueSerialization, 'content', $basePath );
// phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.Found
switch ( $dataValueType = $this->valueTypeLookup->getValueType( $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 execute
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function execute(): void {
if ( !WikibaseSettings::isRepoEnabled() ) {
$this->output( "You need to have Wikibase enabled in order to use this maintenance script!\n\n" );
exit;
}
- 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
ItemId $id,
Labels $labels,
Descriptions $descriptions,
Aliases $aliases,
Sitelinks $sitelinks,
Function assertValidStatements
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function assertValidStatements(
array $statementsSerialization,
Property $originalProperty,
array $originalStatementsSerialization
): void {
- 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
string $propertyId,
array $patch,
array $editTags,
bool $isBot,
?string $comment,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
LabelsSyntaxValidator $labelsSyntaxValidator,
PropertyLabelsContentsValidator $labelsContentsValidator,
DescriptionsSyntaxValidator $descriptionsSyntaxValidator,
PropertyDescriptionsContentsValidator $descriptionsContentsValidator,
AliasesValidator $aliasesValidator,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
string $propertyId,
string $languageCode,
array $editTags,
bool $isBot,
?string $comment,
Method __construct
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
PropertyId $id,
string $dataType,
Labels $labels,
Descriptions $descriptions,
Aliases $aliases,
Function getHtml
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function getHtml( StatementList $statementList ) {
$statementLists = $this->statementGrouper->groupStatements( $statementList );
$html = '';
foreach ( $statementLists as $key => $statements ) {
- 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"