wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

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

<?php
/** Piedmontese (Piemontèis)
 *
 * @file
 * @ingroup Languages
Severity: Major
Found in languages/messages/MessagesPms.php and 20 other locations - About 3 hrs to fix
languages/messages/MessagesAwa.php on lines 1..27
languages/messages/MessagesBan.php on lines 1..27
languages/messages/MessagesBbc_latn.php on lines 1..29
languages/messages/MessagesCsb.php on lines 1..27
languages/messages/MessagesDga.php on lines 1..30
languages/messages/MessagesDty.php on lines 1..27
languages/messages/MessagesGcr.php on lines 1..29
languages/messages/MessagesIba.php on lines 1..29
languages/messages/MessagesLtg.php on lines 1..32
languages/messages/MessagesMad.php on lines 1..27
languages/messages/MessagesMai.php on lines 1..44
languages/messages/MessagesPwn.php on lines 1..32
languages/messages/MessagesRmy.php on lines 1..30
languages/messages/MessagesSco.php on lines 1..27
languages/messages/MessagesShy_latn.php on lines 1..29
languages/messages/MessagesSzy.php on lines 1..31
languages/messages/MessagesTcy.php on lines 1..31
languages/messages/MessagesTrv.php on lines 1..30
languages/messages/MessagesVls.php on lines 1..31
languages/messages/MessagesZea.php on lines 1..40

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

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 21 locations. Consider refactoring.
Open

<?php
/** Scots (Scots)
 *
 * @file
 * @ingroup Languages
Severity: Major
Found in languages/messages/MessagesSco.php and 20 other locations - About 3 hrs to fix
languages/messages/MessagesAwa.php on lines 1..27
languages/messages/MessagesBan.php on lines 1..27
languages/messages/MessagesBbc_latn.php on lines 1..29
languages/messages/MessagesCsb.php on lines 1..27
languages/messages/MessagesDga.php on lines 1..30
languages/messages/MessagesDty.php on lines 1..27
languages/messages/MessagesGcr.php on lines 1..29
languages/messages/MessagesIba.php on lines 1..29
languages/messages/MessagesLtg.php on lines 1..32
languages/messages/MessagesMad.php on lines 1..27
languages/messages/MessagesMai.php on lines 1..44
languages/messages/MessagesPms.php on lines 1..39
languages/messages/MessagesPwn.php on lines 1..32
languages/messages/MessagesRmy.php on lines 1..30
languages/messages/MessagesShy_latn.php on lines 1..29
languages/messages/MessagesSzy.php on lines 1..31
languages/messages/MessagesTcy.php on lines 1..31
languages/messages/MessagesTrv.php on lines 1..30
languages/messages/MessagesVls.php on lines 1..31
languages/messages/MessagesZea.php on lines 1..40

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

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 15 locations. Consider refactoring.
Open

<?php
/** Twi (Twi)
 *
 * @file
 * @ingroup Languages
Severity: Major
Found in languages/messages/MessagesTw.php and 14 other locations - About 3 hrs to fix
languages/messages/MessagesAcf.php on lines 1..30
languages/messages/MessagesDag.php on lines 1..30
languages/messages/MessagesDin.php on lines 1..27
languages/messages/MessagesFat.php on lines 1..29
languages/messages/MessagesGur.php on lines 1..30
languages/messages/MessagesHa.php on lines 1..27
languages/messages/MessagesIgl.php on lines 1..30
languages/messages/MessagesMos.php on lines 1..30
languages/messages/MessagesMrh.php on lines 1..30
languages/messages/MessagesPcm.php on lines 1..27
languages/messages/MessagesPrg.php on lines 1..29
languages/messages/MessagesSyl.php on lines 1..30
languages/messages/MessagesTig.php on lines 1..30
languages/messages/MessagesTn.php on lines 1..30

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

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 15 locations. Consider refactoring.
Open

<?php
/** Fante (mfantse)
 *
 * @file
 * @ingroup Languages
Severity: Major
Found in languages/messages/MessagesFat.php and 14 other locations - About 3 hrs to fix
languages/messages/MessagesAcf.php on lines 1..30
languages/messages/MessagesDag.php on lines 1..30
languages/messages/MessagesDin.php on lines 1..27
languages/messages/MessagesGur.php on lines 1..30
languages/messages/MessagesHa.php on lines 1..27
languages/messages/MessagesIgl.php on lines 1..30
languages/messages/MessagesMos.php on lines 1..30
languages/messages/MessagesMrh.php on lines 1..30
languages/messages/MessagesPcm.php on lines 1..27
languages/messages/MessagesPrg.php on lines 1..29
languages/messages/MessagesSyl.php on lines 1..30
languages/messages/MessagesTig.php on lines 1..30
languages/messages/MessagesTn.php on lines 1..30
languages/messages/MessagesTw.php on lines 1..29

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

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 4 locations. Consider refactoring.
Open

$namespaceAliases = [
    'Иалахә'             => NS_USER,

    // Backward compat. Fallbacks from 'ru'.
    'Медиа'                => NS_MEDIA,
Severity: Major
Found in languages/messages/MessagesAb.php and 3 other locations - About 3 hrs to fix
languages/messages/MessagesCu.php on lines 39..57
languages/messages/MessagesKm.php on lines 41..59
languages/messages/MessagesNah.php on lines 40..58

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

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

    public function prefixSearchSubpages( $search, $limit, $offset ) {
        $title = Title::newFromText( $search, NS_FILE );
        if ( !$title || $title->getNamespace() !== NS_FILE ) {
            // No prefix suggestion outside of file namespace
            return [];
Severity: Major
Found in includes/specials/SpecialFilepath.php and 1 other location - About 3 hrs to fix
includes/specials/SpecialFileDuplicateSearch.php on lines 247..263

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

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 4 locations. Consider refactoring.
Open

$namespaceAliases = [
    'មីឌា' => NS_MEDIA,
    'ពិភាក្សា' => NS_TALK,
    'អ្នកប្រើប្រាស់-ពិភាក្សា' => NS_USER_TALK,
    '$1_ពិភាក្ស' => NS_PROJECT_TALK,
Severity: Major
Found in languages/messages/MessagesKm.php and 3 other locations - About 3 hrs to fix
languages/messages/MessagesAb.php on lines 29..49
languages/messages/MessagesCu.php on lines 39..57
languages/messages/MessagesNah.php on lines 40..58

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

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 4 locations. Consider refactoring.
Open

$namespaceAliases = [
    'Media'        => NS_MEDIA,
    'Especial'    => NS_SPECIAL,
    'Discusión'    => NS_TALK,
    'Usuario'    => NS_USER,
Severity: Major
Found in languages/messages/MessagesNah.php and 3 other locations - About 3 hrs to fix
languages/messages/MessagesAb.php on lines 29..49
languages/messages/MessagesCu.php on lines 39..57
languages/messages/MessagesKm.php on lines 41..59

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

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

    public function prefixSearchSubpages( $search, $limit, $offset ) {
        $title = Title::newFromText( $search, NS_FILE );
        if ( !$title || $title->getNamespace() !== NS_FILE ) {
            // No prefix suggestion outside of file namespace
            return [];
Severity: Major
Found in includes/specials/SpecialFileDuplicateSearch.php and 1 other location - About 3 hrs to fix
includes/specials/SpecialFilepath.php on lines 79..95

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

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 4 locations. Consider refactoring.
Open

$namespaceAliases = [
    'Срѣдьства'                      => NS_MEDIA,
    'Нарочьна'                       => NS_SPECIAL,
    'Бесѣда'                         => NS_TALK,
    'Польѕевател҄ь'                  => NS_USER,
Severity: Major
Found in languages/messages/MessagesCu.php and 3 other locations - About 3 hrs to fix
languages/messages/MessagesAb.php on lines 29..49
languages/messages/MessagesKm.php on lines 41..59
languages/messages/MessagesNah.php on lines 40..58

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

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

File BookletLayout.js has 296 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* global moment */
( function () {

    /**
     * @classdesc Encapsulates the process of uploading a file to MediaWiki

    File ApiQueryUserInfo.php has 296 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Copyright © 2007 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
     *
     * This program is free software; you can redistribute it and/or modify
    Severity: Minor
    Found in includes/api/ApiQueryUserInfo.php - About 3 hrs to fix

      File ProtectedPagesPager.php has 296 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * This program is free software; you can redistribute it and/or modify
       * it under the terms of the GNU General Public License as published by
       * the Free Software Foundation; either version 2 of the License, or
      Severity: Minor
      Found in includes/specials/pagers/ProtectedPagesPager.php - About 3 hrs to fix

        File MessagesTr.php has 296 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /** Turkish (Türkçe)
         *
         * @file
         * @ingroup Languages
        Severity: Minor
        Found in languages/messages/MessagesTr.php - About 3 hrs to fix

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

                  $( '.hideShowRadio' ).on( 'click', function () {
                      const $wrapper = $( '#' + $( this ).attr( 'rel' ) );
                      if ( $( this ).is( ':checked' ) ) {
                          // FIXME: Use CSS transition
                          // eslint-disable-next-line no-jquery/no-animate-toggle
          Severity: Major
          Found in mw-config/config.js and 1 other location - About 3 hrs to fix
          mw-config/config.js on lines 42..52

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

          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 ( config.invert !== null ) {
                      this.invert = new OO.ui.CheckboxInputWidget( Object.assign(
                          { value: '1' },
                          config.invert
                      ) );
          resources/src/mediawiki.widgets/mw.widgets.ComplexNamespaceInputWidget.js on lines 55..68

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

          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

                  $( '.showHideRadio' ).on( 'click', function () {
                      const $wrapper = $( '#' + $( this ).attr( 'rel' ) );
                      if ( $( this ).is( ':checked' ) ) {
                          // FIXME: Use CSS transition
                          // eslint-disable-next-line no-jquery/no-animate-toggle
          Severity: Major
          Found in mw-config/config.js and 1 other location - About 3 hrs to fix
          mw-config/config.js on lines 53..63

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

          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 ( config.associated !== null ) {
                      this.associated = new OO.ui.CheckboxInputWidget( Object.assign(
                          { value: '1' },
                          config.associated
                      ) );
          resources/src/mediawiki.widgets/mw.widgets.ComplexNamespaceInputWidget.js on lines 69..82

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

          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 observeMove has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

          function observeMove(element, onMove) {
            let io = null;
            let timeoutId;
            const root = getDocumentElement(element);
            function cleanup() {
          Severity: Minor
          Found in resources/lib/codex/codex.js - About 3 hrs to fix

          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 loadFromDefinition has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function loadFromDefinition() {
                  if ( $this->definition === null ) {
                      return;
                  }
          
          
          Severity: Minor
          Found in includes/ResourceLoader/ImageModule.php - About 3 hrs to fix

          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

          Severity
          Category
          Status
          Source
          Language