wikimedia/mediawiki-core

View on GitHub

Showing 2,056 of 11,730 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        if ( $addresses ) {
            $resultFromBlob = $this->metadataStorageHelper->getMetadataFromBlobStore( $addresses );
            foreach ( $addresses as $itemName => $address ) {
                unset( $this->unloadedMetadataBlobs[$itemName] );
                $value = $resultFromBlob[$itemName] ?? null;
Severity: Minor
Found in includes/filerepo/file/ArchivedFile.php and 1 other location - About 30 mins to fix
includes/filerepo/file/LocalFile.php on lines 1042..1052

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 91.

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        if ( $addresses ) {
            $resultFromBlob = $this->metadataStorageHelper->getMetadataFromBlobStore( $addresses );
            foreach ( $addresses as $itemName => $address ) {
                unset( $this->unloadedMetadataBlobs[$itemName] );
                $value = $resultFromBlob[$itemName] ?? null;
Severity: Minor
Found in includes/filerepo/file/LocalFile.php and 1 other location - About 30 mins to fix
includes/filerepo/file/ArchivedFile.php on lines 475..485

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 91.

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

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    public function set( float $value ): void {
        foreach ( $this->baseMetric->getStatsdNamespaces() as $namespace ) {
            $this->baseMetric->getStatsdDataFactory()->updateCount( $namespace, $value );
        }

Severity: Minor
Found in includes/libs/Stats/Metrics/GaugeMetric.php and 2 other locations - About 30 mins to fix
includes/libs/Stats/Metrics/CounterMetric.php on lines 75..86
includes/libs/Stats/Metrics/TimingMetric.php on lines 96..107

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 91.

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

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    public function observe( float $value ): void {
        foreach ( $this->baseMetric->getStatsdNamespaces() as $namespace ) {
            $this->baseMetric->getStatsdDataFactory()->timing( $namespace, $value );
        }

Severity: Minor
Found in includes/libs/Stats/Metrics/TimingMetric.php and 2 other locations - About 30 mins to fix
includes/libs/Stats/Metrics/CounterMetric.php on lines 75..86
includes/libs/Stats/Metrics/GaugeMetric.php on lines 66..77

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 91.

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        return Html::openElement( 'li', [ 'class' => $classes ] )
            . Html::rawElement( 'a',
                [ 'href' => "#$linkAnchor" ],
                Html::element( 'span', [ 'class' => 'tocnumber' ], $tocnumber )
                    . ' '
Severity: Minor
Found in includes/linker/Linker.php and 1 other location - About 30 mins to fix
includes/OutputTransform/Stages/HandleTOCMarkers.php on lines 120..126

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 91.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        } elseif ( $dataCombinedLag > self::MAX_READ_LAG ) {
            $pregenCombinedLag = ( $walltime !== null ) ? ( $dataCombinedLag - $walltime ) : 0;
            // Case D: medium snapshot lag with medium replication lag
            if ( ( $pregenCombinedLag + self::GENERATION_HIGH_SEC ) > self::MAX_READ_LAG ) {
                // Case D1: generation started when read lag was too high
Severity: Minor
Found in includes/libs/objectcache/wancache/WANObjectCache.php and 1 other location - About 30 mins to fix
includes/libs/objectcache/wancache/WANObjectCache.php on lines 836..850

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 91.

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        return Html::openElement( 'li', [ 'class' => $classes ] )
            . Html::rawElement( 'a',
                [ 'href' => "#$linkAnchor" ],
                Html::element( 'span', [ 'class' => 'tocnumber' ], $tocnumber )
                    . ' '
Severity: Minor
Found in includes/OutputTransform/Stages/HandleTOCMarkers.php and 1 other location - About 30 mins to fix
includes/linker/Linker.php on lines 1827..1833

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 91.

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

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    public function incrementBy( float $value ): void {
        foreach ( $this->baseMetric->getStatsdNamespaces() as $namespace ) {
            $this->baseMetric->getStatsdDataFactory()->updateCount( $namespace, $value );
        }

Severity: Minor
Found in includes/libs/Stats/Metrics/CounterMetric.php and 2 other locations - About 30 mins to fix
includes/libs/Stats/Metrics/GaugeMetric.php on lines 66..77
includes/libs/Stats/Metrics/TimingMetric.php on lines 96..107

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 91.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if ( isset( $logInfo['contributor']['username'] ) ) {
            $revision->setUsername(
                $this->externalUserNames->applyPrefix( $logInfo['contributor']['username'] )
            );
        } elseif ( isset( $logInfo['contributor']['ip'] ) ) {
Severity: Minor
Found in includes/import/WikiImporter.php and 1 other location - About 30 mins to fix
includes/import/WikiImporter.php on lines 1097..1105

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 91.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        if ( isset( $revisionInfo['contributor']['username'] ) ) {
            $revision->setUsername(
                $this->externalUserNames->applyPrefix( $revisionInfo['contributor']['username'] )
            );
        } elseif ( isset( $revisionInfo['contributor']['ip'] ) ) {
Severity: Minor
Found in includes/import/WikiImporter.php and 1 other location - About 30 mins to fix
includes/import/WikiImporter.php on lines 841..849

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 91.

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

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        } elseif ( $dataSnapshotLag > self::MAX_READ_LAG ) {
            // Case B: high snapshot lag
            $pregenSnapshotLag = ( $walltime !== null ) ? ( $dataSnapshotLag - $walltime ) : 0;
            if ( ( $pregenSnapshotLag + self::GENERATION_HIGH_SEC ) > self::MAX_READ_LAG ) {
                // Case B1: generation started when transaction duration was already long
Severity: Minor
Found in includes/libs/objectcache/wancache/WANObjectCache.php and 1 other location - About 30 mins to fix
includes/libs/objectcache/wancache/WANObjectCache.php on lines 855..869

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 91.

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

Further Reading

Identical blocks of code found in 4 locations. Consider refactoring.
Open

    if (s.sym_next) {
      /*** FLUSH_BLOCK(s, 0); ***/
      flush_block_only(s, false);
      if (s.strm.avail_out === 0) {
        return BS_NEED_MORE;
Severity: Major
Found in resources/lib/pako/pako_deflate.js and 3 other locations - About 30 mins to fix
resources/lib/pako/pako_deflate.js on lines 2206..2213
resources/lib/pako/pako_deflate.js on lines 2367..2374
resources/lib/pako/pako_deflate.js on lines 2466..2473

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 45.

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

Further Reading

Identical blocks of code found in 4 locations. Consider refactoring.
Open

    if (s.sym_next) {
      /*** FLUSH_BLOCK(s, 0); ***/
      flush_block_only(s, false);
      if (s.strm.avail_out === 0) {
        return BS_NEED_MORE;
Severity: Major
Found in resources/lib/pako/pako_deflate.js and 3 other locations - About 30 mins to fix
resources/lib/pako/pako_deflate.js on lines 2367..2374
resources/lib/pako/pako_deflate.js on lines 2466..2473
resources/lib/pako/pako_deflate.js on lines 2523..2530

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 45.

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

Further Reading

Similar blocks of code found in 13 locations. Consider refactoring.
Open

    if ( OO.isPlainObject( outline ) && config === undefined ) {
        config = outline;
        outline = config.outline;
    }
Severity: Major
Found in resources/lib/ooui/oojs-ui-widgets.js and 12 other locations - About 30 mins to fix
resources/lib/ooui/oojs-ui-core.js on lines 12848..12851
resources/lib/ooui/oojs-ui-toolbars.js on lines 701..704
resources/lib/ooui/oojs-ui-toolbars.js on lines 1097..1100
resources/lib/ooui/oojs-ui-toolbars.js on lines 1702..1705
resources/lib/ooui/oojs-ui-toolbars.js on lines 1803..1806
resources/lib/ooui/oojs-ui-toolbars.js on lines 1996..1999
resources/lib/ooui/oojs-ui-toolbars.js on lines 2059..2062
resources/lib/ooui/oojs-ui-toolbars.js on lines 2513..2516
resources/lib/ooui/oojs-ui-toolbars.js on lines 2752..2755
resources/lib/ooui/oojs-ui-widgets.js on lines 1029..1032
resources/lib/ooui/oojs-ui-widgets.js on lines 1193..1196
resources/lib/ooui/oojs-ui-windows.js on lines 637..640

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 45.

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

Further Reading

Similar blocks of code found in 13 locations. Consider refactoring.
Open

    if ( OO.isPlainObject( toolGroup ) && config === undefined ) {
        config = toolGroup;
        toolGroup = config.toolGroup;
    }
Severity: Major
Found in resources/lib/ooui/oojs-ui-toolbars.js and 12 other locations - About 30 mins to fix
resources/lib/ooui/oojs-ui-core.js on lines 12848..12851
resources/lib/ooui/oojs-ui-toolbars.js on lines 1097..1100
resources/lib/ooui/oojs-ui-toolbars.js on lines 1702..1705
resources/lib/ooui/oojs-ui-toolbars.js on lines 1803..1806
resources/lib/ooui/oojs-ui-toolbars.js on lines 1996..1999
resources/lib/ooui/oojs-ui-toolbars.js on lines 2059..2062
resources/lib/ooui/oojs-ui-toolbars.js on lines 2513..2516
resources/lib/ooui/oojs-ui-toolbars.js on lines 2752..2755
resources/lib/ooui/oojs-ui-widgets.js on lines 1029..1032
resources/lib/ooui/oojs-ui-widgets.js on lines 1193..1196
resources/lib/ooui/oojs-ui-widgets.js on lines 3246..3249
resources/lib/ooui/oojs-ui-windows.js on lines 637..640

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 45.

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

Further Reading

Similar blocks of code found in 13 locations. Consider refactoring.
Open

    if ( OO.isPlainObject( toolbar ) && config === undefined ) {
        config = toolbar;
        toolbar = config.toolbar;
    }
Severity: Major
Found in resources/lib/ooui/oojs-ui-toolbars.js and 12 other locations - About 30 mins to fix
resources/lib/ooui/oojs-ui-core.js on lines 12848..12851
resources/lib/ooui/oojs-ui-toolbars.js on lines 701..704
resources/lib/ooui/oojs-ui-toolbars.js on lines 1097..1100
resources/lib/ooui/oojs-ui-toolbars.js on lines 1702..1705
resources/lib/ooui/oojs-ui-toolbars.js on lines 1803..1806
resources/lib/ooui/oojs-ui-toolbars.js on lines 1996..1999
resources/lib/ooui/oojs-ui-toolbars.js on lines 2513..2516
resources/lib/ooui/oojs-ui-toolbars.js on lines 2752..2755
resources/lib/ooui/oojs-ui-widgets.js on lines 1029..1032
resources/lib/ooui/oojs-ui-widgets.js on lines 1193..1196
resources/lib/ooui/oojs-ui-widgets.js on lines 3246..3249
resources/lib/ooui/oojs-ui-windows.js on lines 637..640

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 45.

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

Further Reading

Similar blocks of code found in 13 locations. Consider refactoring.
Open

    if ( OO.isPlainObject( fieldWidget ) && config === undefined ) {
        config = fieldWidget;
        fieldWidget = config.fieldWidget;
    }
Severity: Major
Found in resources/lib/ooui/oojs-ui-core.js and 12 other locations - About 30 mins to fix
resources/lib/ooui/oojs-ui-toolbars.js on lines 701..704
resources/lib/ooui/oojs-ui-toolbars.js on lines 1097..1100
resources/lib/ooui/oojs-ui-toolbars.js on lines 1702..1705
resources/lib/ooui/oojs-ui-toolbars.js on lines 1803..1806
resources/lib/ooui/oojs-ui-toolbars.js on lines 1996..1999
resources/lib/ooui/oojs-ui-toolbars.js on lines 2059..2062
resources/lib/ooui/oojs-ui-toolbars.js on lines 2513..2516
resources/lib/ooui/oojs-ui-toolbars.js on lines 2752..2755
resources/lib/ooui/oojs-ui-widgets.js on lines 1029..1032
resources/lib/ooui/oojs-ui-widgets.js on lines 1193..1196
resources/lib/ooui/oojs-ui-widgets.js on lines 3246..3249
resources/lib/ooui/oojs-ui-windows.js on lines 637..640

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 45.

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

Further Reading

Similar blocks of code found in 13 locations. Consider refactoring.
Open

    if ( OO.isPlainObject( toolbar ) && config === undefined ) {
        config = toolbar;
        toolbar = config.toolbar;
    }
Severity: Major
Found in resources/lib/ooui/oojs-ui-toolbars.js and 12 other locations - About 30 mins to fix
resources/lib/ooui/oojs-ui-core.js on lines 12848..12851
resources/lib/ooui/oojs-ui-toolbars.js on lines 701..704
resources/lib/ooui/oojs-ui-toolbars.js on lines 1702..1705
resources/lib/ooui/oojs-ui-toolbars.js on lines 1803..1806
resources/lib/ooui/oojs-ui-toolbars.js on lines 1996..1999
resources/lib/ooui/oojs-ui-toolbars.js on lines 2059..2062
resources/lib/ooui/oojs-ui-toolbars.js on lines 2513..2516
resources/lib/ooui/oojs-ui-toolbars.js on lines 2752..2755
resources/lib/ooui/oojs-ui-widgets.js on lines 1029..1032
resources/lib/ooui/oojs-ui-widgets.js on lines 1193..1196
resources/lib/ooui/oojs-ui-widgets.js on lines 3246..3249
resources/lib/ooui/oojs-ui-windows.js on lines 637..640

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 45.

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

Further Reading

Similar blocks of code found in 13 locations. Consider refactoring.
Open

    if ( OO.isPlainObject( toolGroup ) && config === undefined ) {
        config = toolGroup;
        toolGroup = config.toolGroup;
    }
Severity: Major
Found in resources/lib/ooui/oojs-ui-toolbars.js and 12 other locations - About 30 mins to fix
resources/lib/ooui/oojs-ui-core.js on lines 12848..12851
resources/lib/ooui/oojs-ui-toolbars.js on lines 701..704
resources/lib/ooui/oojs-ui-toolbars.js on lines 1097..1100
resources/lib/ooui/oojs-ui-toolbars.js on lines 1803..1806
resources/lib/ooui/oojs-ui-toolbars.js on lines 1996..1999
resources/lib/ooui/oojs-ui-toolbars.js on lines 2059..2062
resources/lib/ooui/oojs-ui-toolbars.js on lines 2513..2516
resources/lib/ooui/oojs-ui-toolbars.js on lines 2752..2755
resources/lib/ooui/oojs-ui-widgets.js on lines 1029..1032
resources/lib/ooui/oojs-ui-widgets.js on lines 1193..1196
resources/lib/ooui/oojs-ui-widgets.js on lines 3246..3249
resources/lib/ooui/oojs-ui-windows.js on lines 637..640

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 45.

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

Further Reading

Similar blocks of code found in 13 locations. Consider refactoring.
Open

    if ( OO.isPlainObject( toolbar ) && config === undefined ) {
        config = toolbar;
        toolbar = config.toolbar;
    }
Severity: Major
Found in resources/lib/ooui/oojs-ui-toolbars.js and 12 other locations - About 30 mins to fix
resources/lib/ooui/oojs-ui-core.js on lines 12848..12851
resources/lib/ooui/oojs-ui-toolbars.js on lines 701..704
resources/lib/ooui/oojs-ui-toolbars.js on lines 1097..1100
resources/lib/ooui/oojs-ui-toolbars.js on lines 1702..1705
resources/lib/ooui/oojs-ui-toolbars.js on lines 1803..1806
resources/lib/ooui/oojs-ui-toolbars.js on lines 2059..2062
resources/lib/ooui/oojs-ui-toolbars.js on lines 2513..2516
resources/lib/ooui/oojs-ui-toolbars.js on lines 2752..2755
resources/lib/ooui/oojs-ui-widgets.js on lines 1029..1032
resources/lib/ooui/oojs-ui-widgets.js on lines 1193..1196
resources/lib/ooui/oojs-ui-widgets.js on lines 3246..3249
resources/lib/ooui/oojs-ui-windows.js on lines 637..640

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 45.

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

Further Reading

Severity
Category
Status
Source
Language