Showing 11,545 of 11,545 total issues
Method dfnCheckInterval
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function dfnCheckInterval( $start = null, $end = null, $batchSize = 100 ) {
$dbw = $this->getPrimaryDB();
$dbr = $this->getDB( DB_REPLICA, [ 'vslow' ] );
$linksTables = [
Method fetchMessageInfo
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function fetchMessageInfo( $langCode, array &$messageInfo ) {
$services = $this->getServiceContainer();
$contLang = $services->getContentLanguage();
if ( $langCode ) {
$this->output( "\n... fetching message info for language: $langCode" );
Method doAllPages
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function doAllPages() {
$dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
$i = 0;
$startId = 0;
if ( $this->noCount ) {
Method updateTo2
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function updateTo2( &$json ) {
if ( isset( $json['config'] ) ) {
$config = $json['config'];
$json['config'] = [];
if ( isset( $config['_prefix'] ) ) {
Consider simplifying this complex logical expression. Open
if ( date.getTime() < -62167219200000 || date.getTime() > 253402300799999 ||
date.getUTCFullYear() !== +m[ 1 ] ||
date.getUTCMonth() + 1 !== +m[ 2 ] ||
date.getUTCDate() !== +m[ 3 ] ||
date.getUTCHours() !== +m[ 4 ] ||
Consider simplifying this complex logical expression. Open
if (
title.indexOf( '.' ) !== -1 && (
title === '.' || title === '..' ||
title.indexOf( './' ) === 0 ||
title.indexOf( '../' ) === 0 ||
Consider simplifying this complex logical expression. Open
if ( ( ( $target[0].id != $.datepicker._mainDivId &&
$target.parents('#' + $.datepicker._mainDivId).length == 0 &&
!$target.hasClass($.datepicker.markerClassName) &&
!$target.closest("." + $.datepicker._triggerClass).length &&
$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
Consider simplifying this complex logical expression. Open
if(!(/^(document|window|parent)$/).test(o.containment)) {
var ce = $(o.containment)[0];
var co = $(o.containment).offset();
var over = ($(ce).css("overflow") != 'hidden');
Consider simplifying this complex logical expression. Open
if (this.floating && horizontalDirection) {
return ((horizontalDirection == "right" && isOverRightHalf) || (horizontalDirection == "left" && !isOverRightHalf));
} else {
return verticalDirection && ((verticalDirection == "down" && isOverBottomHalf) || (verticalDirection == "up" && !isOverBottomHalf));
}
Consider simplifying this complex logical expression. Open
if ( $userOptionsLookup->getOption( $watchingUser, 'enotifwatchlistpages' )
&& ( !$minorEdit || $userOptionsLookup->getOption( $watchingUser, 'enotifminoredits' ) )
&& $watchingUser->isEmailConfirmed()
&& $watchingUser->getId() != $userTalkId
&& !in_array( $watchingUser->getName(),
Consider simplifying this complex logical expression. Open
if ( $delta & 1 ) {
for ( $d = 0; $d <= $limit; ++$d ) {
$start_diag = max( $value_to_add_forward + $start_forward, -$d );
$end_diag = min( $end_forward, $d );
$value_to_add_forward = 1 - $value_to_add_forward;
Consider simplifying this complex logical expression. Open
if (
!$this->mOldRevisionRecord || !$this->mNewRevisionRecord
|| !$this->mOldPage || !$this->mNewPage
|| !$this->mOldPage->equals( $this->mNewPage )
|| $this->mOldRevisionRecord->getId() === null
Consider simplifying this complex logical expression. Open
if (
str_contains( $dbkey, '.' ) &&
(
$dbkey === '.' || $dbkey === '..' ||
str_starts_with( $dbkey, './' ) ||
Consider simplifying this complex logical expression. Open
if ( $customised !== $this->custom &&
( ( $asc && ( $key < $offset || !$offset ) ) || ( !$asc && $key > $offset ) ) &&
( ( $this->prefix && preg_match( $this->prefix, $key ) ) || $this->prefix === false )
) {
$actual = $this->msg( $key )->inLanguage( $this->lang )->plain();
Consider simplifying this complex logical expression. Open
if ( isset( self::METADATA_ELEMENTS[$elementName] )
&& !self::isTableOfContentsMarker( $element )
) {
// The element is a metadata element, that we allow to appear in
// both inline and block contexts.
Similar blocks of code found in 2 locations. Consider refactoring. Open
public static function newFromIDs( $ids ) {
$ids = array_map( 'intval', (array)$ids ); // paranoia
if ( !$ids ) {
// Database::select() doesn't like empty arrays
return new ArrayIterator( [] );
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 114.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
private function getTargetAndType( ?string $par, WebRequest $request ) {
$possibleTargets = [
$request->getVal( 'wpTarget', null ),
$par,
$request->getVal( 'ip', null ),
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 114.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
public static function newFromNames( $names ) {
$names = array_map( 'strval', (array)$names ); // paranoia
if ( !$names ) {
// Database::select() doesn't like empty arrays
return new ArrayIterator( [] );
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 114.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ( isset( $settings[self::PARAM_MAX_CHARS] ) && $len > $settings[self::PARAM_MAX_CHARS] ) {
$this->failure(
$this->failureMessage( 'maxchars', [
'maxbytes' => $settings[self::PARAM_MAX_BYTES] ?? null,
'maxchars' => $settings[self::PARAM_MAX_CHARS] ?? null,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 114.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
protected function clearTempAccountCreationThrottle( string $ip ): void {
$this->output( 'Clearing temp account creation throttle...' );
$tempAccountCreationThrottle = $this->getConfig()->get( MainConfigNames::TempAccountCreationThrottle );
if ( !$tempAccountCreationThrottle ) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 114.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76