wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Function selectSQLText has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function selectSQLText(
        $tables, $vars, $conds = '', $fname = __METHOD__, $options = [], $join_conds = []
    ) {
        if ( is_string( $options ) ) {
            $options = [ $options ];
Severity: Minor
Found in includes/libs/rdbms/platform/PostgresPlatform.php - About 4 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 reuseOrOpenConnectionForNewRef has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    private function reuseOrOpenConnectionForNewRef( $i, DatabaseDomain $domain, $flags = 0 ) {
        // Figure out which connection pool to use based on the flags
        if ( $this->fieldHasBit( $flags, self::CONN_UNTRACKED_GAUGE ) ) {
            // Use low timeouts, use autocommit mode, ignore transaction rounds
            $category = self::CATEGORY_GAUGE;
Severity: Minor
Found in includes/libs/rdbms/loadbalancer/LoadBalancer.php - About 4 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 getFooterIconsData has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getFooterIconsData( Config $config ) {
        $footericons = [];
        foreach (
            $config->get( MainConfigNames::FooterIcons ) as $footerIconsKey => &$footerIconsBlock
        ) {
Severity: Minor
Found in includes/skins/components/SkinComponentFooter.php - About 4 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 formatDiffRow2 has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public static function formatDiffRow2(
        $title, $oldid, $newid, $timestamp, $formattedComment, $actiontext = ''
    ) {
        $feedDiffCutoff = MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::FeedDiffCutoff );

Severity: Minor
Found in includes/Feed/FeedUtils.php - About 4 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 extractParam has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    protected function extractParam( $param, $format ) {
        if ( is_array( $param ) ) {
            if ( isset( $param['raw'] ) ) {
                return [ 'after', $param['raw'] ];
            } elseif ( isset( $param['num'] ) ) {
Severity: Minor
Found in includes/Message/Message.php - About 4 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 setupUser has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function setupUser() {
        $dbUser = $this->getVar( 'wgDBuser' );
        if ( $dbUser == $this->getVar( '_InstallUser' ) ) {
            return Status::newGood();
        }
Severity: Minor
Found in includes/installer/MysqlInstaller.php - About 4 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 execute has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $pages = $this->getPageSet()->getGoodPages();
        if ( $pages === [] ) {
            return;
        }
Severity: Minor
Found in includes/api/ApiQueryLangLinks.php - About 4 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 execute has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $params = $this->extractRequestParams();

        $prop = array_fill_keys( $params['prop'], true );

Severity: Minor
Found in includes/api/ApiQueryTags.php - About 4 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 execute has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        // If we're in a mode that breaks the same-origin policy, no tokens can
        // be obtained
        if ( $this->lacksSameOriginSecurity() ) {
            $this->getResult()->addValue( null, 'login', [
Severity: Minor
Found in includes/api/ApiLogin.php - About 4 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 showResults has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function showResults( $term ) {
        if ( $this->searchEngineType !== null ) {
            $this->setExtraParam( 'srbackend', $this->searchEngineType );
        }

Severity: Minor
Found in includes/specials/SpecialSearch.php - About 4 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 processFormInternal has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    private static function processFormInternal(
        array $data,
        Authority $performer,
        BlockUserFactory $blockUserFactory,
        BlockUtils $blockUtils
Severity: Minor
Found in includes/specials/SpecialBlock.php - About 4 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 showUploadWarning has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    protected function showUploadWarning( $warnings ) {
        # If there are no warnings, or warnings we can ignore, return early.
        # mDestWarningAck is set when some javascript has shown the warning
        # to the user. mForReUpload is set when the user clicks the "upload a
        # new version" link.
Severity: Minor
Found in includes/specials/SpecialUpload.php - About 4 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 formatValue has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function formatValue( $name, $value ) {
        static $msg = null;
        if ( $msg === null ) {
            $keys = [
                'anononlyblock',
Severity: Minor
Found in includes/specials/pagers/BlockListPager.php - About 4 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 transform has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function transform( $params, $flags = 0 ) {
        $thumbnailEpoch = MediaWikiServices::getInstance()->getMainConfig()
            ->get( MainConfigNames::ThumbnailEpoch );

        do {
Severity: Minor
Found in includes/filerepo/file/File.php - About 4 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 setOriginal has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function setOriginal( $rev, $originalRendering ) {
        if ( $originalRendering instanceof ParsoidRenderID ) {
            $renderId = $originalRendering;

            // If the client asked for a render ID, load original data from stash
Severity: Minor
Found in includes/Rest/Handler/Helper/HtmlInputTransformHelper.php - About 4 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 getLogText has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getLogText( $block, $queryParams, $allLogs, $isnew, $namehidden ) {
        if ( !$block ) {
            return '';
        }

Severity: Minor
Found in includes/recentchanges/EnhancedChangesList.php - About 4 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 start has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    public function start() {
        // Trap SIGTERM
        pcntl_signal( SIGTERM, [ $this, 'handleTermSignal' ], false );

        do {
Severity: Minor
Found in maintenance/includes/ForkController.php - About 4 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 updateTemplatedParameters has 102 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    ApiSandbox.PageLayout.prototype.updateTemplatedParameters = function ( params ) {
        const layout = this,
            pi = this.paramInfo,
            prefix = layout.prefix + pi.prefix;

Severity: Major
Found in resources/src/mediawiki.special.apisandbox/apisandbox.js - About 4 hrs to fix

    Function exports has 102 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function ( $inlineToggleSwitchLayout ) {
        let $wikitextDiffContainer, $wikitextDiffHeader, $wikitextDiffBody,
            $wikitextDiffBodyInline, $wikitextDiffBodyTable,
            url = new URL( location.href ),
            api = new mw.Api(),
    Severity: Major
    Found in resources/src/mediawiki.diff/inlineFormatToggle.js - About 4 hrs to fix

      Function TapReporter has 102 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        var TapReporter = /*#__PURE__*/function () {
          function TapReporter(runner) {
            var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
            _classCallCheck(this, TapReporter);
            // Cache references to console methods to ensure we can report failures
      Severity: Major
      Found in resources/lib/qunitjs/qunit.js - About 4 hrs to fix
        Severity
        Category
        Status
        Source
        Language