wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Function _sfc_render has 120 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  const _component_cdx_icon = resolveComponent("cdx-icon");
  const _component_cdx_menu = resolveComponent("cdx-menu");
  const _component_cdx_search_input = resolveComponent("cdx-search-input");
  return openBlock(), createElementBlock(
Severity: Major
Found in resources/lib/codex/codex.js - About 4 hrs to fix

    Method prepareUpdate has 120 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function prepareUpdate( RevisionRecord $revision, array $options = [] ) {
            Assert::parameter(
                !isset( $options['oldrevision'] )
                || $options['oldrevision'] instanceof RevisionRecord,
                '$options["oldrevision"]',
    Severity: Major
    Found in includes/Storage/DerivedPageDataUpdater.php - About 4 hrs to fix

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

            createElementVNode("span", _hoisted_5$7, [
              _ctx.icon ? (openBlock(), createBlock(_component_cdx_icon, {
                key: 0,
                icon: _ctx.icon,
                class: "cdx-label__label__icon"
      Severity: Major
      Found in resources/lib/codex/codex.js and 1 other location - About 4 hrs to fix
      resources/lib/codex/codex.js on lines 1195..1211

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

      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

            }, _ctx.otherAttrs), [
              _ctx.icon ? (openBlock(), createBlock(_component_cdx_icon, {
                key: 0,
                icon: _ctx.icon,
                class: "cdx-label__label__icon"
      Severity: Major
      Found in resources/lib/codex/codex.js and 1 other location - About 4 hrs to fix
      resources/lib/codex/codex.js on lines 1230..1246

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

      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 construct has 119 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              construct: function ( $tables, settings ) {
                  return $tables.each( ( i, table ) => {
                      // Declare and cache.
                      let cache,
                          $table = $( table ),
      Severity: Major
      Found in resources/src/jquery.tablesorter/jquery.tablesorter.js - About 4 hrs to fix

        Function _sfc_render$m has 119 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
          const _component_cdx_thumbnail = resolveComponent("cdx-thumbnail");
          const _component_cdx_icon = resolveComponent("cdx-icon");
          const _component_cdx_search_result_title = resolveComponent("cdx-search-result-title");
          return openBlock(), createElementBlock("li", {
        Severity: Major
        Found in resources/lib/codex/codex.js - About 4 hrs to fix

          Function makeApi has 119 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function makeApi(sinon) {
                  function stub(object, property, func) {
                      if (!!func && typeof func !== "function" && typeof func !== "object") {
                          throw new TypeError("Custom stub should be a function or a property descriptor");
                      }
          Severity: Major
          Found in resources/lib/sinonjs/sinon.js - About 4 hrs to fix

            Method parseParameters has 119 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function parseParameters( $params ) {
                    $prop = array_fill_keys( $params['prop'], true );
            
                    $this->fld_ids = isset( $prop['ids'] );
                    $this->fld_flags = isset( $prop['flags'] );
            Severity: Major
            Found in includes/api/ApiQueryRevisionsBase.php - About 4 hrs to fix

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

              <?php
              
              namespace MediaWiki\Specials;
              
              use MediaWiki\CommentStore\CommentStore;
              Severity: Minor
              Found in includes/specials/SpecialRenameUser.php - About 4 hrs to fix

                Method run has 119 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function run() {
                        $scope = RequestContext::importScopedSession( $this->params['session'] );
                        $this->addTeardownCallback( static function () use ( &$scope ) {
                            ScopedCallback::consume( $scope ); // T126450
                        } );
                Severity: Major
                Found in includes/jobqueue/jobs/AssembleUploadChunksJob.php - About 4 hrs to fix

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

                  <?php
                  
                  namespace MediaWiki\Parser\Parsoid;
                  
                  use Composer\Semver\Semver;
                  Severity: Minor
                  Found in includes/parser/Parsoid/HtmlToContentTransform.php - About 4 hrs to fix

                    Function checkQuickPermissions has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function checkQuickPermissions(
                            $action,
                            User $user,
                            PermissionStatus $status,
                            $rigor,
                    Severity: Minor
                    Found in includes/Permissions/PermissionManager.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 expandFileInfo has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function expandFileInfo( Context $context, $fileInfo, $debugKey ) {
                            if ( is_string( $fileInfo ) ) {
                                // Inline common case
                                return [
                                    'name' => $fileInfo,
                    Severity: Minor
                    Found in includes/ResourceLoader/FileModule.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 loadFromSubmission has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function loadFromSubmission( array $data ) {
                            $fields = array_filter( $this->getFieldInfo(), static function ( $info ) {
                                return $info['type'] !== 'null';
                            } );
                            if ( !$fields ) {
                    Severity: Minor
                    Found in includes/auth/AuthenticationRequest.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 dumpPages has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function dumpPages( $cond, $orderRevs ) {
                            $revQuery = $this->revisionStore->getQueryInfo( [ 'page' ] );
                            $slotQuery = $this->revisionStore->getSlotsQueryInfo( [ 'content' ] );
                    
                            // We want page primary rather than revision.
                    Severity: Minor
                    Found in includes/export/WikiExporter.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 doUpdates has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function doUpdates() {
                            $this->assertTransition( 'done' );
                    
                            // TODO: move logic into a PageEventEmitter service
                    
                    
                    Severity: Minor
                    Found in includes/Storage/DerivedPageDataUpdater.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 requestMultiWithAuth has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function requestMultiWithAuth( array $reqs, $options = [] ) {
                            $remainingTries = 2;
                            $auth = $this->getAuthentication();
                            while ( true ) {
                                if ( !$auth ) {
                    Severity: Minor
                    Found in includes/libs/filebackend/SwiftFileBackend.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 getConnectionsForKeys has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function getConnectionsForKeys( array $keys ) {
                            $keysByServer = [];
                            $connByServer = [];
                            $success = true;
                            foreach ( $keys as $key ) {
                    Severity: Minor
                    Found in includes/libs/objectcache/RedisBagOStuff.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 tableNamesWithIndexClauseOrJOIN has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function tableNamesWithIndexClauseOrJOIN(
                            $tables,
                            $use_index = [],
                            $ignore_index = [],
                            $join_conds = []
                    Severity: Minor
                    Found in includes/libs/rdbms/platform/SQLPlatform.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 convertByteClassToUnicodeClass has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function convertByteClassToUnicodeClass( $byteClass ) {
                            $length = strlen( $byteClass );
                            // Input token queue
                            $x0 = $x1 = $x2 = '';
                            // Decoded queue
                    Severity: Minor
                    Found in includes/title/Title.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

                    Severity
                    Category
                    Status
                    Source
                    Language