wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

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

            if ( ( isset( $show['minor'] ) && isset( $show['!minor'] ) )
                || ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) )
                || ( isset( $show['autopatrolled'] ) && isset( $show['!autopatrolled'] ) )
                || ( isset( $show['autopatrolled'] ) && isset( $show['!patrolled'] ) )
                || ( isset( $show['top'] ) && isset( $show['!top'] ) )
Severity: Major
Found in includes/api/ApiQueryUserContribs.php and 1 other location - About 1 hr to fix
includes/api/ApiQueryRecentChanges.php on lines 205..210

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

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

    public function getConnection( $i, $groups = [], $domain = false, $flags = 0 ) {
        if ( self::fieldHasBit( $flags, self::CONN_SILENCE_ERRORS ) ) {
            throw new UnexpectedValueException(
                __METHOD__ . ' got CONN_SILENCE_ERRORS; connection is already deferred'
            );
Severity: Major
Found in includes/libs/rdbms/loadbalancer/LoadBalancer.php and 1 other location - About 1 hr to fix
includes/libs/rdbms/loadbalancer/LoadBalancer.php on lines 832..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 117.

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

    public function __construct(
        ApiMain $main,
        $action,
        RevisionLookup $revisionLookup,
        SkinFactory $skinFactory,
Severity: Major
Found in includes/api/ApiParse.php and 1 other location - About 1 hr to fix
includes/api/ApiQueryInfo.php on lines 196..230

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

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

    protected function doIsRootJobOldDuplicate( IJobSpecification $job ) {
        $signature = $job->getRootJobParams()['rootJobSignature'];
        $partition = $this->partitionRing->getLiveLocation( $signature );
        try {
            return $this->partitionQueues[$partition]->doIsRootJobOldDuplicate( $job );
Severity: Major
Found in includes/jobqueue/JobQueueFederated.php and 1 other location - About 1 hr to fix
includes/jobqueue/JobQueueFederated.php on lines 321..334

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

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

    protected function doDeduplicateRootJob( IJobSpecification $job ) {
        $signature = $job->getRootJobParams()['rootJobSignature'];
        $partition = $this->partitionRing->getLiveLocation( $signature );
        try {
            return $this->partitionQueues[$partition]->doDeduplicateRootJob( $job );
Severity: Major
Found in includes/jobqueue/JobQueueFederated.php and 1 other location - About 1 hr to fix
includes/jobqueue/JobQueueFederated.php on lines 306..319

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

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

    public function __construct(
        ApiQuery $queryModule,
        $moduleName,
        Language $contentLanguage,
        LinkBatchFactory $linkBatchFactory,
Severity: Major
Found in includes/api/ApiQueryInfo.php and 1 other location - About 1 hr to fix
includes/api/ApiParse.php on lines 118..153

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

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( $show['minor'] ) && isset( $show['!minor'] ) )
                || ( isset( $show['bot'] ) && isset( $show['!bot'] ) )
                || ( isset( $show['anon'] ) && isset( $show['!anon'] ) )
                || ( isset( $show['redirect'] ) && isset( $show['!redirect'] ) )
                || ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) )
Severity: Major
Found in includes/api/ApiQueryRecentChanges.php and 1 other location - About 1 hr to fix
includes/api/ApiQueryUserContribs.php on lines 470..475

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

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

    public function getMaintenanceConnectionRef(
        $i,
        $groups = [],
        $domain = false,
        $flags = 0
Severity: Major
Found in includes/libs/rdbms/loadbalancer/LoadBalancer.php and 1 other location - About 1 hr to fix
includes/libs/rdbms/loadbalancer/LoadBalancer.php on lines 743..756

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

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

Function lengthLimit has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function lengthLimit( trimFn, limit, filterFunction ) {
        const allowNativeMaxlength = trimFn === trimByteLength;

        // If the first argument is the function,
        // set filterFunction to the first argument's value and ignore the second argument.
Severity: Minor
Found in resources/src/jquery.lengthLimit.js - About 1 hr to fix

    Function parseImageUrl has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        parseImageUrl: function ( url ) {
            let name, decodedName, width, urlTemplate;
    
            // thumb.php-generated thumbnails
            // thumb.php?f=<name>&w[idth]=<width>[px]
    Severity: Minor
    Found in resources/src/mediawiki.util/util.js - About 1 hr to fix

      Function convertGrammar has 45 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              convertGrammar: function ( word, form ) {
                  var endAllative, jot, hyphen, ending;
      
                  // Ending for allative case
                  endAllative = 'мæ';
      Severity: Minor
      Found in resources/lib/jquery.i18n/src/languages/os.js - About 1 hr to fix

        Function _sfc_render$b has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
          const _component_cdx_toggle_button = resolveComponent("cdx-toggle-button");
          const _component_cdx_menu = resolveComponent("cdx-menu");
          return openBlock(), createElementBlock(
            "div",
        Severity: Minor
        Found in resources/lib/codex/codex.js - About 1 hr to fix

          Function done has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function done() {
              // We have reached the end of the processing queue and are about to emit the
              // "runEnd" event after which reporters typically stop listening and exit
              // the process. First, check if we need to emit one final test.
              if (config.stats.testCount === 0 && config.failOnZeroTests === true) {
          Severity: Minor
          Found in resources/lib/qunitjs/qunit.js - About 1 hr to fix

            Function _sfc_render$9 has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
              const _component_cdx_text_input = resolveComponent("cdx-text-input");
              const _component_cdx_button = resolveComponent("cdx-button");
              return openBlock(), createElementBlock(
                "div",
            Severity: Minor
            Found in resources/lib/codex/codex.js - About 1 hr to fix

              Function _sfc_render$2 has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
                const _component_cdx_icon = resolveComponent("cdx-icon");
                const _component_cdx_toggle_button = resolveComponent("cdx-toggle-button");
                return openBlock(), createElementBlock(
                  "div",
              Severity: Minor
              Found in resources/lib/codex/codex.js - About 1 hr to fix

                Function makeApi has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function makeApi(sinon) {
                        function Server() {}
                        Server.prototype = sinon.fakeServer;
                
                        sinon.fakeServerWithClock = new Server();
                Severity: Minor
                Found in resources/lib/sinonjs/sinon.js - About 1 hr to fix

                  Function addCombinator has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function addCombinator( matcher, combinator, base ) {
                      var dir = combinator.dir,
                          skip = combinator.next,
                          key = skip || dir,
                          checkNonElements = base && key === "parentNode",
                  Severity: Minor
                  Found in resources/lib/jquery/jquery.js - About 1 hr to fix

                    Function val has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        val: function( value ) {
                            var hooks, ret, valueIsFunction,
                                elem = this[ 0 ];
                    
                            if ( !arguments.length ) {
                    Severity: Minor
                    Found in resources/lib/jquery/jquery.js - About 1 hr to fix

                      Function _tabKeydown has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          _tabKeydown: function( event ) {
                              var focusedTab = $( this.document[0].activeElement ).closest( "li" ),
                                  selectedIndex = this.tabs.index( focusedTab ),
                                  goingForward = true;
                      
                      
                      Severity: Minor
                      Found in resources/lib/jquery.ui/jquery.ui.tabs.js - About 1 hr to fix

                        Method showTOC has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function showTOC( $metadata ) {
                                $r = [
                                    Html::rawElement(
                                        'li',
                                        [],
                        Severity: Minor
                        Found in includes/page/ImagePage.php - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language