wikimedia/mediawiki-core

View on GitHub

Showing 11,461 of 11,461 total issues

Method loadRegs has 311 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function loadRegs() {
        // Regexes as keys need to be declared in a function.
        $this->Cyrl2LatnRegexes = [
            # относятся ко всему слову
            # whole words
Severity: Major
Found in includes/languages/data/CrhExceptions.php - About 1 day to fix

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

    <?php
    /**
     * DBMS-specific updater helper.
     *
     * This program is free software; you can redistribute it and/or modify
    Severity: Major
    Found in includes/installer/DatabaseUpdater.php - About 1 day to fix

      Function compressWithConcat has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
      Open

          private function compressWithConcat( $startId, $maxChunkSize, $beginDate,
              $endDate, $extdb = "", $maxPageId = false
          ) {
              $dbr = $this->getReplicaDB();
              $dbw = $this->getPrimaryDB();
      Severity: Minor
      Found in maintenance/storage/compressOld.php - About 1 day 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

      Method braceSubstitution has 310 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function braceSubstitution( array $piece, PPFrame $frame ) {
              // Flags
      
              // $text has been filled
              $found = false;
      Severity: Major
      Found in includes/parser/Parser.php - About 1 day to fix

        LoadBalancer has 82 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class LoadBalancer implements ILoadBalancerForOwner {
            /** @var ILoadMonitor */
            private $loadMonitor;
            /** @var BagOStuff */
            private $srvCache;
        Severity: Major
        Found in includes/libs/rdbms/loadbalancer/LoadBalancer.php - About 1 day to fix

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

          <?php
          /**
           * Core installer web interface.
           *
           * This program is free software; you can redistribute it and/or modify
          Severity: Major
          Found in includes/installer/WebInstaller.php - About 1 day to fix

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

              var mapActions = normalizeNamespace(function (namespace, actions) {
                var res = {};
                if (!isValidMap(actions)) {
                  console.error('[vuex] mapActions: mapper parameter must be either an Array or an Object');
                }
            Severity: Major
            Found in resources/lib/vuex/vuex.global.js and 1 other location - About 1 day to fix
            resources/lib/vuex/vuex.global.js on lines 1216..1244

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

            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

              var mapMutations = normalizeNamespace(function (namespace, mutations) {
                var res = {};
                if (!isValidMap(mutations)) {
                  console.error('[vuex] mapMutations: mapper parameter must be either an Array or an Object');
                }
            Severity: Major
            Found in resources/lib/vuex/vuex.global.js and 1 other location - About 1 day to fix
            resources/lib/vuex/vuex.global.js on lines 1285..1313

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

            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 Message.php has 679 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/Message/Message.php - About 1 day to fix

              Function getContentObject has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function getContentObject( $def_content = null ) {
                      $services = MediaWikiServices::getInstance();
                      $disableAnonTalk = $services->getMainConfig()->get( MainConfigNames::DisableAnonTalk );
                      $request = $this->context->getRequest();
              
              
              Severity: Minor
              Found in includes/editpage/EditPage.php - About 1 day 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 77 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function execute() {
                      $user = $this->getUser();
                      $db = $this->getDB();
              
                      $params = $this->extractRequestParams();
              Severity: Minor
              Found in includes/api/ApiQueryFilearchive.php - About 1 day 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 doSubmit has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function doSubmit() {
                      $user = $this->getUser();
              
                      if ( $user->pingLimiter( 'move' ) ) {
                          throw new ThrottledError;
              Severity: Minor
              Found in includes/specials/SpecialMovePage.php - About 1 day 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 ExtensionProcessor.php has 677 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              use MediaWiki\MainConfigNames;
              use MediaWiki\ResourceLoader\FilePath;
              
              
              Severity: Major
              Found in includes/registration/ExtensionProcessor.php - About 1 day to fix

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

                /*!
                 * jQuery UI Dialog 1.9.2
                 * http://jqueryui.com
                 *
                 * Copyright 2012 jQuery Foundation and other contributors
                Severity: Major
                Found in resources/lib/jquery.ui/jquery.ui.dialog.js - About 1 day to fix

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

                  <?php
                  namespace MediaWiki\Languages\Data;
                  
                  use CrhConverter as Crh;
                  
                  
                  Severity: Major
                  Found in includes/languages/data/CrhExceptions.php - About 1 day to fix

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

                        public static function listDropdownOptions( $list, $params = [] ) {
                            $options = [];
                    
                            if ( isset( $params['other'] ) ) {
                                $options[ $params['other'] ] = 'other';
                    Severity: Major
                    Found in includes/xml/Xml.php and 1 other location - About 1 day to fix
                    includes/Html/Html.php on lines 1163..1203

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

                    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 static function listDropdownOptions( $list, $params = [] ) {
                            $options = [];
                    
                            if ( isset( $params['other'] ) ) {
                                $options[ $params['other'] ] = 'other';
                    Severity: Major
                    Found in includes/Html/Html.php and 1 other location - About 1 day to fix
                    includes/xml/Xml.php on lines 580..620

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

                    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

                    FileBackend has 81 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    abstract class FileBackend implements LoggerAwareInterface {
                        /** @var string Unique backend name */
                        protected $name;
                    
                        /** @var string Unique domain name */
                    Severity: Major
                    Found in includes/libs/filebackend/FileBackend.php - About 1 day to fix

                      Function internalAttemptSave has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function internalAttemptSave( &$result, $markAsBot = false, $markAsMinor = false ) {
                              // If an attempt to acquire a temporary name failed, don't attempt to do anything else.
                              if ( $this->unableToAcquireTempName ) {
                                  $status = Status::newFatal( 'temp-user-unable-to-acquire' );
                                  $status->value = self::AS_UNABLE_TO_ACQUIRE_TEMP_ACCOUNT;
                      Severity: Minor
                      Found in includes/editpage/EditPage.php - About 1 day 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 doQuotes has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function doQuotes( $text ) {
                              $arr = preg_split( "/(''+)/", $text, -1, PREG_SPLIT_DELIM_CAPTURE );
                              $countarr = count( $arr );
                              if ( $countarr == 1 ) {
                                  return $text;
                      Severity: Minor
                      Found in includes/parser/Parser.php - About 1 day 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