wikimedia/mediawiki-core

View on GitHub

Showing 9,711 of 11,779 total issues

File PermissionManager.php has 1134 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/Permissions/PermissionManager.php - About 2 days to fix

    File vuex.global.js has 1133 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     * vuex v4.0.2
     * (c) 2021 Evan You
     * @license MIT
     */
    Severity: Major
    Found in resources/lib/vuex/vuex.global.js - About 2 days to fix

      Function braceSubstitution has a Cognitive Complexity of 142 (exceeds 5 allowed). Consider refactoring.
      Open

          public function braceSubstitution( array $piece, PPFrame $frame ) {
              // Flags
      
              // $text has been filled
              $found = false;
      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 fuzzysortNew has 577 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            function fuzzysortNew(instanceOptions) {
              var fuzzysort = {
                single: function single(search, target, options) {
                  if (search == 'farzher') return {
                    target: "farzher was here (^-^*)/",
      Severity: Major
      Found in resources/lib/qunitjs/qunit.js - About 2 days to fix

        Parser has 146 functions (exceeds 20 allowed). Consider refactoring.
        Open

        #[\AllowDynamicProperties]
        class Parser {
            use DeprecationHelper;
        
            # Flags for Parser::setFunctionHook
        Severity: Major
        Found in includes/parser/Parser.php - About 2 days to fix

          Function run has a Cognitive Complexity of 140 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function run( ApiPageSet $resultPageSet = null ) {
                  $db = $this->getDB();
                  $params = $this->extractRequestParams( false );
          
                  $result = $this->getResult();
          Severity: Minor
          Found in includes/api/ApiQueryAllDeletedRevisions.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 Installer.php has 1112 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /**
           * Base code for MediaWiki installer.
           *
           * DO NOT PATCH THIS FILE IF YOU NEED TO CHANGE INSTALLER BEHAVIOR IN YOUR PACKAGE!
          Severity: Major
          Found in includes/installer/Installer.php - About 2 days to fix

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

            <?php
            /**
             * @defgroup FileAbstraction File abstraction
             * @ingroup FileRepo
             *
            Severity: Major
            Found in includes/filerepo/file/File.php - About 2 days to fix

              ParserOutput has 142 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class ParserOutput extends CacheTime implements ContentMetadataCollector {
                  use GhostFieldAccessTrait;
                  use JsonUnserializableTrait;
                  // This is used to break cyclic dependencies and allow a measure
                  // of compatibility when new methods are added to ContentMetadataCollector
              Severity: Major
              Found in includes/parser/ParserOutput.php - About 2 days to fix

                File WANObjectCache.php has 1092 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/libs/objectcache/wancache/WANObjectCache.php - About 2 days to fix

                  File FileBackendStore.php has 1071 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  /**
                   * Base class for all backends using particular storage medium.
                   *
                   * This program is free software; you can redistribute it and/or modify
                  Severity: Major
                  Found in includes/libs/filebackend/FileBackendStore.php - About 2 days to fix

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

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

                      File ApiBase.php has 1061 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

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

                        File SkinTemplate.php has 1059 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        /**
                         * Copyright © Gabriel Wicke -- http://www.aulinx.de/
                         *
                         * This program is free software; you can redistribute it and/or modify
                        Severity: Major
                        Found in includes/skins/SkinTemplate.php - About 2 days to fix

                          User has 136 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          #[AllowDynamicProperties]
                          class User implements Authority, UserIdentity, UserEmailContact {
                              use DebugInfoTrait;
                              use ProtectedHookAccessorTrait;
                              use WikiAwareEntityTrait;
                          Severity: Major
                          Found in includes/user/User.php - About 2 days to fix

                            File has 135 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            abstract class File implements MediaHandlerState {
                                use ProtectedHookAccessorTrait;
                            
                                // Bitfield values akin to the revision deletion constants
                                public const DELETED_FILE = 1;
                            Severity: Major
                            Found in includes/filerepo/file/File.php - About 2 days to fix

                              Method buildDomTreeArrayFromText has 523 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private function buildDomTreeArrayFromText( $text, $flags ) {
                                      $forInclusion = ( $flags & self::DOM_FOR_INCLUSION );
                                      $langConversionDisabled = ( $flags & self::DOM_LANG_CONVERSION_DISABLED );
                              
                                      $xmlishElements = $this->parser->getStripList();
                              Severity: Major
                              Found in includes/parser/Preprocessor_Hash.php - About 2 days to fix

                                File Sanitizer.php has 1036 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                <?php
                                /**
                                 * HTML sanitizer for %MediaWiki.
                                 *
                                 * Copyright © 2002-2005 Brooke Vibber <bvibber@wikimedia.org> et al
                                Severity: Major
                                Found in includes/parser/Sanitizer.php - About 2 days to fix

                                  File CoreParserFunctions.php has 1027 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  <?php
                                  /**
                                   * Parser functions provided by MediaWiki core
                                   *
                                   * This program is free software; you can redistribute it and/or modify
                                  Severity: Major
                                  Found in includes/parser/CoreParserFunctions.php - About 2 days to fix

                                    File GlobalFunctions.php has 1026 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    <?php
                                    /**
                                     * Global functions used everywhere.
                                     *
                                     * This program is free software; you can redistribute it and/or modify
                                    Severity: Major
                                    Found in includes/GlobalFunctions.php - About 2 days to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language