wikimedia/mediawiki-core

View on GitHub

Showing 11,730 of 11,730 total issues

Similar blocks of code found in 3 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/zh-hk.js and 2 other locations - About 3 days to fix
resources/lib/moment/locale/zh-mo.js on lines 7..111
resources/lib/moment/locale/zh-tw.js on lines 6..110

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

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 Skin.php has 1438 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/skins/Skin.php - About 3 days to fix

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

    <?php
    /**
     * Class for DatabaseBlock objects to interact with the database
     *
     * This program is free software; you can redistribute it and/or modify
    Severity: Major
    Found in includes/block/DatabaseBlockStore.php - About 3 days to fix

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

      <?php
      /**
       * User interface for the difference engine.
       *
       * This program is free software; you can redistribute it and/or modify
      Severity: Major
      Found in includes/diff/DifferenceEngine.php - About 3 days to fix

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

        <?php
        /**
         * Formatting of image metadata values into human readable form.
         *
         * This program is free software; you can redistribute it and/or modify
        Severity: Major
        Found in includes/media/FormatMetadata.php - About 3 days to fix

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

          <?php
          /**
           * Base class for the backend of file upload.
           *
           * This program is free software; you can redistribute it and/or modify
          Severity: Major
          Found in includes/upload/UploadBase.php - About 3 days to fix

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

                public function execute() {
                    // The data is hot but user-dependent, like page views, so we set vary cookies
                    $this->getMain()->setCacheMode( 'anon-public-user-private' );
            
                    // Get parameters
            Severity: Minor
            Found in includes/api/ApiParse.php - About 3 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 Article.php has 1328 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/page/Article.php - About 3 days to fix

              File ParserOutput.php has 1324 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/parser/ParserOutput.php - About 3 days to fix

                File ChangesListSpecialPage.php has 1321 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/specialpage/ChangesListSpecialPage.php - About 3 days to fix

                  Similar blocks of code found in 2 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/mk.js and 1 other location - About 3 days to fix
                  resources/lib/moment/locale/bg.js on lines 5..96

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

                  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

                  ;(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/bg.js and 1 other location - About 3 days to fix
                  resources/lib/moment/locale/mk.js on lines 6..97

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

                  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 LoadBalancer.php has 1305 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/rdbms/loadbalancer/LoadBalancer.php - About 3 days to fix

                    Title has 168 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Title implements LinkTarget, PageIdentity {
                        use WikiAwareEntityTrait;
                        use LinkTargetTrait;
                    
                        /** @var MapCacheLRU|null */
                    Severity: Major
                    Found in includes/title/Title.php - About 3 days to fix

                      Function UMD has 665 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          })(commonjsGlobal, function UMD() {
                            function fuzzysortNew(instanceOptions) {
                              var fuzzysort = {
                                single: function single(search, target, options) {
                                  if (search == 'farzher') return {
                      Severity: Major
                      Found in resources/lib/qunitjs/qunit.js - About 3 days to fix

                        File SQLPlatform.php has 1271 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/rdbms/platform/SQLPlatform.php - About 3 days to fix

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

                          <?php
                          /**
                           * Implements Special:Undelete
                           *
                           * This program is free software; you can redistribute it and/or modify
                          Severity: Major
                          Found in includes/specials/SpecialUndelete.php - About 3 days to fix

                            Function getMetadata has a Cognitive Complexity of 161 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public static function getMetadata( $filename ) {
                                    self::$pngSig = pack( "C8", 137, 80, 78, 71, 13, 10, 26, 10 );
                                    self::$crcSize = 4;
                                    /* based on list at http://owl.phy.queensu.ca/~phil/exiftool/TagNames/PNG.html#TextualData
                                     * and https://www.w3.org/TR/PNG/#11keywords
                            Severity: Minor
                            Found in includes/media/PNGMetadataExtractor.php - About 3 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

                            ;(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/nl.js and 1 other location - About 3 days to fix
                            resources/lib/moment/locale/nl-be.js on lines 6..113

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

                            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

                            ;(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/nl-be.js and 1 other location - About 3 days to fix
                            resources/lib/moment/locale/nl.js on lines 6..113

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

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language