wikimedia/mediawiki-core

View on GitHub

Showing 11,779 of 11,779 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/de-at.js and 2 other locations - About 2 days to fix
resources/lib/moment/locale/de-ch.js on lines 5..84
resources/lib/moment/locale/de.js on lines 7..86

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

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

;(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/de-ch.js and 2 other locations - About 2 days to fix
resources/lib/moment/locale/de-at.js on lines 8..87
resources/lib/moment/locale/de.js on lines 7..86

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

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

;(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/de.js and 2 other locations - About 2 days to fix
resources/lib/moment/locale/de-at.js on lines 8..87
resources/lib/moment/locale/de-ch.js on lines 5..84

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

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 execute has a Cognitive Complexity of 146 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $this->useTransactionalTimeLimit();

        $user = $this->getUser();
        $params = $this->extractRequestParams();
Severity: Minor
Found in includes/api/ApiEditPage.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

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

    public function execute() {
        // Before doing anything at all, let's check permissions
        $this->checkUserRightsAny( 'deletedhistory' );

        $this->addDeprecation( 'apiwarn-deprecation-deletedrevs', 'action=query&list=deletedrevs' );
Severity: Minor
Found in includes/api/ApiQueryDeletedrevs.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

Language has 149 functions (exceeds 20 allowed). Consider refactoring.
Open

class Language implements Bcp47Code {
    use DebugInfoTrait;

    /** @var string */
    public $mCode;
Severity: Major
Found in includes/language/Language.php - About 2 days to fix

    File SqlBagOStuff.php has 1141 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Object caching using a SQL database.
     *
     * This program is free software; you can redistribute it and/or modify
    Severity: Major
    Found in includes/objectcache/SqlBagOStuff.php - About 2 days to fix

      File PermissionManager.php has 1134 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/Permissions/PermissionManager.php - About 2 days to fix

        File vuex.global.js has 1133 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*!
         * vuex v4.0.2
         * (c) 2021 Evan You
         * @license MIT
         */
        Severity: Major
        Found in resources/lib/vuex/vuex.global.js - About 2 days to fix

          Function braceSubstitution has a Cognitive Complexity of 142 (exceeds 5 allowed). Consider refactoring.
          Open

              public function braceSubstitution( array $piece, PPFrame $frame ) {
                  // Flags
          
                  // $text has been filled
                  $found = false;
          Severity: Minor
          Found in includes/parser/Parser.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

          Function fuzzysortNew has 577 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                function fuzzysortNew(instanceOptions) {
                  var fuzzysort = {
                    single: function single(search, target, options) {
                      if (search == 'farzher') return {
                        target: "farzher was here (^-^*)/",
          Severity: Major
          Found in resources/lib/qunitjs/qunit.js - About 2 days to fix

            Parser has 146 functions (exceeds 20 allowed). Consider refactoring.
            Open

            #[\AllowDynamicProperties]
            class Parser {
                use DeprecationHelper;
            
                # Flags for Parser::setFunctionHook
            Severity: Major
            Found in includes/parser/Parser.php - About 2 days to fix

              Function run has a Cognitive Complexity of 140 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function run( ApiPageSet $resultPageSet = null ) {
                      $db = $this->getDB();
                      $params = $this->extractRequestParams( false );
              
                      $result = $this->getResult();
              Severity: Minor
              Found in includes/api/ApiQueryAllDeletedRevisions.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

              File Installer.php has 1112 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /**
               * Base code for MediaWiki installer.
               *
               * DO NOT PATCH THIS FILE IF YOU NEED TO CHANGE INSTALLER BEHAVIOR IN YOUR PACKAGE!
              Severity: Major
              Found in includes/installer/Installer.php - About 2 days to fix

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

                <?php
                /**
                 * @defgroup FileAbstraction File abstraction
                 * @ingroup FileRepo
                 *
                Severity: Major
                Found in includes/filerepo/file/File.php - About 2 days to fix

                  ParserOutput has 142 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class ParserOutput extends CacheTime implements ContentMetadataCollector {
                      use GhostFieldAccessTrait;
                      use JsonUnserializableTrait;
                      // This is used to break cyclic dependencies and allow a measure
                      // of compatibility when new methods are added to ContentMetadataCollector
                  Severity: Major
                  Found in includes/parser/ParserOutput.php - About 2 days to fix

                    File WANObjectCache.php has 1092 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/objectcache/wancache/WANObjectCache.php - About 2 days to fix

                      File FileBackendStore.php has 1071 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      /**
                       * Base class for all backends using particular storage medium.
                       *
                       * This program is free software; you can redistribute it and/or modify
                      Severity: Major
                      Found in includes/libs/filebackend/FileBackendStore.php - About 2 days to fix

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

                        /*!
                         * jQuery UI Tabs 1.9.2
                         * http://jqueryui.com
                         *
                         * Copyright 2012 jQuery Foundation and other contributors
                        Severity: Major
                        Found in resources/lib/jquery.ui/jquery.ui.tabs.js - About 2 days to fix

                          File ApiBase.php has 1061 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          <?php
                          /**
                           * Copyright © 2006, 2010 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
                           *
                           * This program is free software; you can redistribute it and/or modify
                          Severity: Major
                          Found in includes/api/ApiBase.php - About 2 days to fix
                            Severity
                            Category
                            Status
                            Source
                            Language