wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

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

<?php
/** Hebrew (עברית)
 *
 * @file
 * @ingroup Languages
Severity: Minor
Found in languages/messages/MessagesHe.php - About 4 hrs to fix

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

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

      Method imageLinks has 105 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function imageLinks() {
              $limit = 100;
      
              $out = $this->getContext()->getOutput();
      
      
      Severity: Major
      Found in includes/page/ImagePage.php - About 4 hrs to fix

        Method retrieveMetaData has 105 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function retrieveMetaData() {
                $config = MediaWikiServices::getInstance()->getMainConfig();
                $djvuDump = $config->get( MainConfigNames::DjvuDump );
                $djvuTxt = $config->get( MainConfigNames::DjvuTxt );
                $djvuUseBoxedCommand = $config->get( MainConfigNames::DjvuUseBoxedCommand );
        Severity: Major
        Found in includes/media/DjVuImage.php - About 4 hrs to fix

          Method getAllowedParams has 105 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getAllowedParams() {
                  $slotRoles = $this->slotRoleRegistry->getKnownRoles();
                  sort( $slotRoles, SORT_STRING );
                  $smallLimit = $this->getMain()->canApiHighLimits() ? ApiBase::LIMIT_SML2 : ApiBase::LIMIT_SML1;
          
          
          Severity: Major
          Found in includes/api/ApiQueryRevisionsBase.php - About 4 hrs to fix

            Method recentChangesBlockLine has 105 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function recentChangesBlockLine( $rcObj ) {
                    $data = [];
            
                    $type = $rcObj->mAttribs['rc_type'];
                    $logType = $rcObj->mAttribs['rc_log_type'];
            Severity: Major
            Found in includes/recentchanges/EnhancedChangesList.php - About 4 hrs to fix

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

              <?php
              /** Czech (čeština)
               *
               * @file
               * @ingroup Languages
              Severity: Minor
              Found in languages/messages/MessagesCs.php - About 4 hrs to fix

                Function deepEqualCyclic has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function deepEqualCyclic(obj1, obj2) {
                
                        // used for cyclic comparison
                        // contain already visited objects
                        var objects1 = [],
                Severity: Major
                Found in resources/lib/sinonjs/sinon.js - About 4 hrs to fix

                  Function then has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                                  then: function( onFulfilled, onRejected, onProgress ) {
                                      var maxDepth = 0;
                                      function resolve( depth, deferred, handler, special ) {
                                          return function() {
                                              var that = this,
                  Severity: Major
                  Found in resources/lib/jquery/jquery.js - About 4 hrs to fix

                    Method getUserLinks has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function getUserLinks(
                            SpecialPage $sp,
                            User $target
                        ) {
                            $id = $target->getId();
                    Severity: Major
                    Found in includes/specialpage/ContributionsSpecialPage.php - About 4 hrs to fix

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

                          private function run( $resultPageSet = null ) {
                              $params = $this->extractRequestParams();
                              $db = $this->getDB();
                      
                              $query = $params['query'];
                      Severity: Major
                      Found in includes/api/ApiQueryExtLinksUsage.php - About 4 hrs to fix

                        Method execute has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function execute() {
                                // Get parameters
                                $params = $this->extractRequestParams();
                        
                                $this->helpFormat = $params['helpformat'];
                        Severity: Major
                        Found in includes/api/ApiParamInfo.php - About 4 hrs to fix

                          Method wt2html has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function wt2html(
                                  PageConfig $pageConfig, array $attribs, ?string $wikitext = null
                              ) {
                                  $request = $this->getRequest();
                                  $opts = $attribs['opts'];
                          Severity: Major
                          Found in includes/Rest/Handler/ParsoidHandler.php - About 4 hrs to fix

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

                                function plural(word, num) {
                                    var forms = word.split('_');
                                    return num % 10 === 1 && num % 100 !== 11
                                        ? forms[0]
                                        : num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20)
                            Severity: Major
                            Found in resources/lib/moment/locale/uk.js and 2 other locations - About 4 hrs to fix
                            resources/lib/moment/locale/be.js on lines 16..23
                            resources/lib/moment/locale/ru.js on lines 16..23

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

                            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 plural(word, num) {
                                    var forms = word.split('_');
                                    return num % 10 === 1 && num % 100 !== 11
                                        ? forms[0]
                                        : num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20)
                            Severity: Major
                            Found in resources/lib/moment/locale/ru.js and 2 other locations - About 4 hrs to fix
                            resources/lib/moment/locale/be.js on lines 16..23
                            resources/lib/moment/locale/uk.js on lines 15..22

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

                            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 plural(word, num) {
                                    var forms = word.split('_');
                                    return num % 10 === 1 && num % 100 !== 11
                                        ? forms[0]
                                        : num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20)
                            Severity: Major
                            Found in resources/lib/moment/locale/be.js and 2 other locations - About 4 hrs to fix
                            resources/lib/moment/locale/ru.js on lines 16..23
                            resources/lib/moment/locale/uk.js on lines 15..22

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

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

                            const ItemMenuOptionWidget = function MwRcfiltersUiItemMenuOptionWidget(
                                controller, filtersViewModel, invertModel, itemModel, highlightPopup, config
                            ) {
                                const $label = $( '<div>' )
                                    .addClass( 'mw-rcfilters-ui-itemMenuOptionWidget-label' );
                            Severity: Major
                            Found in resources/src/mediawiki.rcfilters/ui/ItemMenuOptionWidget.js - About 4 hrs to fix

                              Function _create has 103 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  _create: function() {
                                      this.originalTitle = this.element.attr( "title" );
                                      // #5742 - .attr() might return a DOMElement
                                      if ( typeof this.originalTitle !== "string" ) {
                                          this.originalTitle = "";
                              Severity: Major
                              Found in resources/lib/jquery.ui/jquery.ui.dialog.js - About 4 hrs to fix

                                Method getCharset has 103 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public static function getCharset( $tag ) {
                                        // According to iim standard, charset is defined by the tag 1:90.
                                        // in which there are iso 2022 escape sequences to specify the character set.
                                        // the iim standard seems to encourage that all necessary escape sequences are
                                        // in the 1:90 tag, but says it doesn't have to be.
                                Severity: Major
                                Found in includes/media/IPTC.php - About 4 hrs to fix

                                  Method performUpload has 103 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      protected function performUpload( $warnings ) {
                                          // Use comment as initial page text by default
                                          $this->mParams['text'] ??= $this->mParams['comment'];
                                  
                                          /** @var LocalFile $file */
                                  Severity: Major
                                  Found in includes/api/ApiUpload.php - About 4 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language