wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

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

    _out: function(event) {

        var draggable = $.ui.ddmanager.current;
        if (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element

Severity: Major
Found in resources/lib/jquery.ui/jquery.ui.droppable.js and 1 other location - About 6 hrs to fix
resources/lib/jquery.ui/jquery.ui.droppable.js on lines 82..92

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

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

        if (this.gps.GPSLatitude) {
            var latitude;
            latitude = this.gps.GPSLatitude.value[0].asFloat() + 
            (1 / 60) * this.gps.GPSLatitude.value[1].asFloat() + 
            (1 / 3600) * this.gps.GPSLatitude.value[2].asFloat();
Severity: Major
Found in resources/src/mediawiki.libs.jpegmeta/jpegmeta.js and 1 other location - About 6 hrs to fix
resources/src/mediawiki.libs.jpegmeta/jpegmeta.js on lines 718..727

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

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

        if (this.gps.GPSLongitude) {
            var longitude;
            longitude = this.gps.GPSLongitude.value[0].asFloat() + 
            (1 / 60) * this.gps.GPSLongitude.value[1].asFloat() + 
            (1 / 3600) * this.gps.GPSLongitude.value[2].asFloat();
Severity: Major
Found in resources/src/mediawiki.libs.jpegmeta/jpegmeta.js and 1 other location - About 6 hrs to fix
resources/src/mediawiki.libs.jpegmeta/jpegmeta.js on lines 708..717

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

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

    mw.UriRelative = function ( documentLocation ) {
        const getDefaultUri = ( function () {
            // Cache
            let href, uri;

Severity: Major
Found in resources/src/mediawiki.Uri/Uri.js - About 6 hrs to fix

    Method doMainQuery has 167 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function doMainQuery( $tables, $select, $conds, $query_options,
            $join_conds, FormOptions $opts
        ) {
            $target = $opts['target'];
            $showlinkedto = $opts['showlinkedto'];
    Severity: Major
    Found in includes/specials/SpecialRecentChangesLinked.php - About 6 hrs to fix

      Sanitizer has 48 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Sanitizer {
          /**
           * Regular expression to match various types of character references in
           * Sanitizer::normalizeCharReferences and Sanitizer::decodeCharReferences.
           * Note that HTML5 allows some named entities to omit the trailing
      Severity: Minor
      Found in includes/parser/Sanitizer.php - About 6 hrs to fix

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

                withDirectives(createElementVNode(
                  "div",
                  _hoisted_2$2,
                  [
                    createVNode(_component_cdx_button, {
        Severity: Major
        Found in resources/lib/codex/codex.js and 1 other location - About 6 hrs to fix
        resources/lib/codex/codex.js on lines 9022..9047

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

        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

                withDirectives(createElementVNode(
                  "div",
                  _hoisted_5$1,
                  [
                    createVNode(_component_cdx_button, {
        Severity: Major
        Found in resources/lib/codex/codex.js and 1 other location - About 6 hrs to fix
        resources/lib/codex/codex.js on lines 8953..8978

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

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

            private function run( $resultPageSet = null ) {
                $db = $this->getDB();
                $params = $this->extractRequestParams();
        
                $pfx = $this->tablePrefix;
        Severity: Major
        Found in includes/api/ApiQueryAllLinks.php - About 6 hrs to fix

          Method makeImage has 166 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function makeImage( LinkTarget $link, $options, $holders = false ) {
                  # Check if the options text is of the form "options|alt text"
                  # Options are:
                  #  * thumbnail  make a thumbnail with enlarge-icon and caption, alignment depends on lang
                  #  * left       no resizing, just left align. label is used for alt= only
          Severity: Major
          Found in includes/parser/Parser.php - About 6 hrs to fix

            File ApiQueryLogEvents.php has 443 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: Minor
            Found in includes/api/ApiQueryLogEvents.php - About 6 hrs to fix

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

              /*!
               * jQuery UI Position 1.9.2
               * http://jqueryui.com
               *
               * Copyright 2012 jQuery Foundation and other contributors
              Severity: Minor
              Found in resources/lib/jquery.ui/jquery.ui.position.js - About 6 hrs to fix

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

                    protected function run( ApiPageSet $resultPageSet = null ) {
                        $pageSet = $this->getPageSet();
                        $pageMap = $pageSet->getGoodAndMissingTitlesByNamespace();
                        $pageCount = count( $pageSet->getGoodAndMissingPages() );
                        $revCount = $pageSet->getRevisionCount();
                Severity: Major
                Found in includes/api/ApiQueryDeletedRevisions.php - About 6 hrs to fix

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

                  <?php
                  /** Magahi (मगही)
                   *
                   * @file
                   * @ingroup Languages
                  Severity: Major
                  Found in languages/messages/MessagesMag.php and 1 other location - About 6 hrs to fix
                  languages/messages/MessagesAnp.php on lines 1..46

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

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

                  $namespaceAliases = [
                      'مه‌دیا'         => NS_MEDIA,
                      'مدیا'          => NS_MEDIA,
                      'ویژه'          => NS_SPECIAL,
                      'بحث'           => NS_TALK,
                  Severity: Major
                  Found in languages/messages/MessagesMzn.php and 2 other locations - About 6 hrs to fix
                  languages/messages/MessagesGan_hant.php on lines 28..55
                  languages/messages/MessagesMl.php on lines 54..81

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

                  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
                  /** Angika (अंगिका)
                   *
                   * @file
                   * @ingroup Languages
                  Severity: Major
                  Found in languages/messages/MessagesAnp.php and 1 other location - About 6 hrs to fix
                  languages/messages/MessagesMag.php on lines 1..46

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

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

                  $namespaceAliases = [
                      '媒體' => NS_MEDIA,
                      '特別' => NS_SPECIAL,
                      '談詑' => NS_TALK,
                      '用戶' => NS_USER,
                  Severity: Major
                  Found in languages/messages/MessagesGan_hant.php and 2 other locations - About 6 hrs to fix
                  languages/messages/MessagesMl.php on lines 54..81
                  languages/messages/MessagesMzn.php on lines 43..70

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

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

                  $namespaceAliases = [
                      'സം' => NS_TALK,
                      'അംഗം' => NS_USER,
                      'ഉ' => NS_USER,
                      'അംഗങ്ങളുടെ_സംവാദം' => NS_USER_TALK,
                  Severity: Major
                  Found in languages/messages/MessagesMl.php and 2 other locations - About 6 hrs to fix
                  languages/messages/MessagesGan_hant.php on lines 28..55
                  languages/messages/MessagesMzn.php on lines 43..70

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

                  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 Handler.php has 441 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  namespace MediaWiki\Rest;
                  
                  use DateTime;
                  Severity: Minor
                  Found in includes/Rest/Handler.php - About 6 hrs to fix

                    Function getLocalURL has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getLocalURL( $query = '' ) {
                            global $wgArticlePath, $wgScript, $wgMainPageIsDomainRoot;
                    
                            $query = is_array( $query ) ? wfArrayToCgi( $query ) : $query;
                    
                    
                    Severity: Minor
                    Found in includes/title/Title.php - About 6 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