wikimedia/mediawiki-core

View on GitHub

Showing 11,461 of 11,461 total issues

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

;(function (global, factory) {
   typeof exports === 'object' && typeof module !== 'undefined'
       && typeof require === 'function' ? factory(require('../moment')) :
   typeof define === 'function' && define.amd ? define(['../moment'], factory) :
   factory(global.moment)
Severity: Major
Found in resources/lib/moment/locale/uz-latn.js and 4 other locations - About 2 days to fix
resources/lib/moment/locale/bm.js on lines 5..62
resources/lib/moment/locale/tzm-latn.js on lines 5..64
resources/lib/moment/locale/tzm.js on lines 5..64
resources/lib/moment/locale/uz.js on lines 5..62

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

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 5 locations. Consider refactoring.
Open

;(function (global, factory) {
   typeof exports === 'object' && typeof module !== 'undefined'
       && typeof require === 'function' ? factory(require('../moment')) :
   typeof define === 'function' && define.amd ? define(['../moment'], factory) :
   factory(global.moment)
Severity: Major
Found in resources/lib/moment/locale/bm.js and 4 other locations - About 2 days to fix
resources/lib/moment/locale/tzm-latn.js on lines 5..64
resources/lib/moment/locale/tzm.js on lines 5..64
resources/lib/moment/locale/uz-latn.js on lines 5..64
resources/lib/moment/locale/uz.js on lines 5..62

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

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 5 locations. Consider refactoring.
Open

;(function (global, factory) {
   typeof exports === 'object' && typeof module !== 'undefined'
       && typeof require === 'function' ? factory(require('../moment')) :
   typeof define === 'function' && define.amd ? define(['../moment'], factory) :
   factory(global.moment)
Severity: Major
Found in resources/lib/moment/locale/tzm.js and 4 other locations - About 2 days to fix
resources/lib/moment/locale/bm.js on lines 5..62
resources/lib/moment/locale/tzm-latn.js on lines 5..64
resources/lib/moment/locale/uz-latn.js on lines 5..64
resources/lib/moment/locale/uz.js on lines 5..62

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

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 PageUpdater.php has 837 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/PageUpdater.php - About 2 days to fix

    Function expand has a Cognitive Complexity of 100 (exceeds 5 allowed). Consider refactoring.
    Open

        public function expand( $root, $flags = 0 ) {
            static $expansionDepth = 0;
            if ( is_string( $root ) ) {
                return $root;
            }
    Severity: Minor
    Found in includes/parser/PPFrame_Hash.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

    Similar blocks of code found in 2 locations. 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/SpecialMostCategories.php and 1 other location - About 2 days to fix
    includes/specials/SpecialMostInterwikis.php on lines 1..145

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

    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

    <?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/specials/SpecialMostInterwikis.php and 1 other location - About 2 days to fix
    includes/specials/SpecialMostCategories.php on lines 1..143

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

    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

    Method internalAttemptSave has 399 lines of code (exceeds 25 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: Major
    Found in includes/editpage/EditPage.php - About 1 day to fix

      Function wikiTextToAst has 398 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          wikiTextToAst: function ( input ) {
              var pos,
                  regularLiteral, regularLiteralWithoutBar, regularLiteralWithoutSpace, regularLiteralWithSquareBrackets,
                  doubleQuote, singleQuote, backslash, anyCharacter, asciiAlphabetLiteral,
                  escapedOrLiteralWithoutSpace, escapedOrLiteralWithoutBar, escapedOrRegularLiteral,
      Severity: Major
      Found in resources/src/mediawiki.jqueryMsg/mediawiki.jqueryMsg.js - About 1 day to fix

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

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

          File ApiQuery.php has 827 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/ApiQuery.php - About 1 day to fix

            File ApiQueryInfo.php has 818 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/ApiQueryInfo.php - About 1 day to fix

              Function getDiffRevision has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function getDiffRevision( $prefix, array $params ) {
                      // Back compat params
                      $this->requireMaxOneParameter( $params, "{$prefix}text", "{$prefix}slots" );
                      $this->requireMaxOneParameter( $params, "{$prefix}section", "{$prefix}slots" );
                      if ( $params["{$prefix}text"] !== null ) {
              Severity: Minor
              Found in includes/api/ApiComparePages.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

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

                          'ActionFilteredLogs' => [
                              'block' => [
                                  'block' => [
                                      'block',
                                  ],
              Severity: Major
              Found in includes/config-schema.php and 1 other location - About 1 day to fix
              includes/MainConfigSchema.php on lines 11843..11902

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

              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

                      'default' => [
                          'block' => [
                              'block' => [ 'block' ],
                              'reblock' => [ 'reblock' ],
                              'unblock' => [ 'unblock' ],
              Severity: Major
              Found in includes/MainConfigSchema.php and 1 other location - About 1 day to fix
              includes/config-schema.php on lines 2283..2416

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

              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 SpecialUpload.php has 811 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/specials/SpecialUpload.php - About 1 day to fix

                Function highlightText has a Cognitive Complexity of 96 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function highlightText(
                        $text,
                        $terms,
                        $contextlines = self::DEFAULT_CONTEXT_LINES,
                        $contextchars = self::DEFAULT_CONTEXT_CHARS
                Severity: Minor
                Found in includes/search/SearchHighlighter.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

                SQLPlatform has 100 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class SQLPlatform implements ISQLPlatform {
                    /** @var array[] Current map of (table => (dbname, schema, prefix) map) */
                    protected $tableAliases = [];
                    /** @var string[] Current map of (index alias => index) */
                    protected $indexAliases = [];
                Severity: Major
                Found in includes/libs/rdbms/platform/SQLPlatform.php - About 1 day to fix

                  Method showForm has 381 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function showForm( $err, $isPermError = false ) {
                          $this->getSkin()->setRelevantTitle( $this->oldTitle );
                  
                          $out = $this->getOutput();
                          $out->setPageTitleMsg( $this->msg( 'move-page' )->plaintextParams( $this->oldTitle->getPrefixedText() ) );
                  Severity: Major
                  Found in includes/specials/SpecialMovePage.php - About 1 day to fix

                    WikiPage has 99 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class WikiPage implements Page, PageRecord {
                        use NonSerializableTrait;
                        use ProtectedHookAccessorTrait;
                        use WikiAwareEntityTrait;
                    
                    
                    Severity: Major
                    Found in includes/page/WikiPage.php - About 1 day to fix
                      Severity
                      Category
                      Status
                      Source
                      Language