wikimedia/mediawiki-core

View on GitHub

Showing 9,711 of 11,779 total issues

File oojs-ui-toolbars.js has 1020 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * OOUI v0.49.1
 * https://www.mediawiki.org/wiki/OOUI
 *
 * Copyright 2011–2024 OOUI Team and other contributors.
Severity: Major
Found in resources/lib/ooui/oojs-ui-toolbars.js - About 2 days to fix

    File HTMLForm.php has 1020 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * HTML form generation and submission handling.
     *
    Severity: Major
    Found in includes/htmlform/HTMLForm.php - About 2 days to fix

      Function 1 has 497 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.lolex = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
      (function (global){
      (function (global) {
          
          var userAgent = global.navigator && global.navigator.userAgent;
      Severity: Major
      Found in resources/lib/sinonjs/sinon.js - About 2 days to fix

        File MediaWikiServices.php has 991 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: Major
        Found in includes/MediaWikiServices.php - About 2 days to fix

          File FileRepo.php has 988 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /**
           * @defgroup FileRepo File Repository
           *
           * @brief This module handles how MediaWiki interacts with filesystems.
          Severity: Major
          Found in includes/filerepo/FileRepo.php - About 2 days to fix

            File jquery.ui.effect.js has 978 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /*!
             * jQuery UI Effects 1.9.2
             * http://jqueryui.com
             *
             * Copyright 2012 jQuery Foundation and other contributors
            Severity: Major
            Found in resources/lib/jquery.ui/jquery.ui.effect.js - About 2 days to fix

              Function execute has a Cognitive Complexity of 119 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function execute() {
                      $db = $this->getDB();
                      $params = $this->extractRequestParams();
                      $this->requireMaxOneParameter( $params, 'userids', 'users' );
              
              
              Severity: Minor
              Found in includes/api/ApiQueryUsers.php - About 2 days 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

              File SpecialVersion.php has 960 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /**
               * Copyright © 2005 Ævar Arnfjörð Bjarmason
               *
               * This program is free software; you can redistribute it and/or modify
              Severity: Major
              Found in includes/specials/SpecialVersion.php - About 2 days to fix

                File DerivedPageDataUpdater.php has 959 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: Major
                Found in includes/Storage/DerivedPageDataUpdater.php - About 2 days to fix

                  File ApiPageSet.php has 958 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /**
                   * Copyright © 2006, 2013 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
                   *
                   * This program is free software; you can redistribute it and/or modify
                  Severity: Major
                  Found in includes/api/ApiPageSet.php - About 2 days to fix

                    Function handleInternalLinks2 has a Cognitive Complexity of 117 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function handleInternalLinks2( &$s ) {
                            static $tc = false, $e1, $e1_img;
                            # the % is needed to support urlencoded titles as well
                            if ( !$tc ) {
                                $tc = Title::legalChars() . '#%';
                    Severity: Minor
                    Found in includes/parser/Parser.php - About 2 days 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 117 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function execute() {
                            $text = $this->text;
                            # Parsing through the text line by line.  The main thing
                            # happening here is handling of block-level elements p, pre,
                            # and making lists from lines starting with * # : etc.
                    Severity: Minor
                    Found in includes/parser/BlockLevelPass.php - About 2 days 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

                    File BanConverter.php has 949 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: Major
                    Found in includes/language/converters/BanConverter.php - About 2 days to fix

                      File ApiQuerySiteinfo.php has 948 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

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

                        File LoginSignupSpecialPage.php has 947 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        /**
                         * Holds shared logic for login and account creation pages.
                         *
                         * This program is free software; you can redistribute it and/or modify
                        Severity: Major
                        Found in includes/specialpage/LoginSignupSpecialPage.php - About 2 days to fix

                          Method __construct has 462 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function __construct(
                                  $name,
                                  $restriction,
                                  UserIdentityUtils $userIdentityUtils,
                                  TempUserConfig $tempUserConfig
                          Severity: Major
                          Found in includes/specialpage/ChangesListSpecialPage.php - About 2 days to fix

                            File mediawiki.loader.js has 928 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            /*!
                             * Defines mw.loader, the infrastructure for loading ResourceLoader
                             * modules.
                             *
                             * This file is appended directly to the code in startup/mediawiki.js
                            Severity: Major
                            Found in resources/src/startup/mediawiki.loader.js - About 2 days to fix

                              Function recache has a Cognitive Complexity of 113 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function recache( $code ) {
                                      if ( !$code ) {
                                          throw new InvalidArgumentException( "Invalid language code requested" );
                                      }
                                      $this->recachedLangs[ $code ] = true;
                              Severity: Minor
                              Found in includes/language/LocalisationCache.php - About 2 days 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 run has a Cognitive Complexity of 113 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  protected function run( ApiPageSet $resultPageSet = null ) {
                                      $params = $this->extractRequestParams( false );
                              
                                      // If any of those parameters are used, work in 'enumeration' mode.
                                      // Enum mode can only be used when exactly one page is provided.
                              Severity: Minor
                              Found in includes/api/ApiQueryRevisions.php - About 2 days 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

                              File MessageCache.php has 916 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: Major
                              Found in includes/language/MessageCache.php - About 2 days to fix
                                Severity
                                Category
                                Status
                                Source
                                Language