wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Function searchCategories has 95 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    mw.widgets.CategoryMultiselectWidget.prototype.searchCategories = function ( input, searchType ) {
        const deferred = $.Deferred(),
            cacheKey = input + searchType.toString();

        // Check cache

    Method truncateHtml has 95 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function truncateHtml( $text, $length, $ellipsis = '...' ) {
            # Use the localized ellipsis character
            if ( $ellipsis == '...' ) {
                $ellipsis = $this->msg( 'ellipsis' )->escaped();
            }
    Severity: Major
    Found in includes/language/Language.php - About 3 hrs to fix

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

          public function getAllowedParams() {
              return [
                  'allrev' => false,
                  'start' => [
                      ParamValidator::PARAM_TYPE => 'timestamp'
      Severity: Major
      Found in includes/api/ApiQueryWatchlist.php - About 3 hrs to fix

        Method selectUploadModule has 95 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function selectUploadModule() {
                // chunk or one and only one of the following parameters is needed
                if ( !$this->mParams['chunk'] ) {
                    $this->requireOnlyOneParameter( $this->mParams,
                        'filekey', 'file', 'url' );
        Severity: Major
        Found in includes/api/ApiUpload.php - About 3 hrs to fix

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

          <?php
          
          /**
           * API for MediaWiki 1.12+
           *
          Severity: Minor
          Found in includes/api/ApiQueryAllImages.php - About 3 hrs to fix

            Method processFormInternal has 95 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static function processFormInternal(
                    array $data,
                    Authority $performer,
                    BlockUserFactory $blockUserFactory,
                    BlockUtils $blockUtils
            Severity: Major
            Found in includes/specials/SpecialBlock.php - About 3 hrs to fix

              Method doTagRow has 95 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function doTagRow(
                      $tag, $hitcount, $showManageActions, $showDeleteActions, $showEditLinks
                  ) {
                      $newRow = '';
                      $newRow .= Xml::tags( 'td', null, Xml::element( 'code', null, $tag ) );
              Severity: Major
              Found in includes/specials/SpecialTags.php - About 3 hrs to fix

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

                            if (format === 'dddd') {
                                ii = indexOf.call(this._weekdaysParse, llc);
                                if (ii !== -1) {
                                    return ii;
                                }
                Severity: Major
                Found in resources/lib/moment/moment.js and 1 other location - About 3 hrs to fix
                resources/lib/moment/moment.js on lines 1616..1638

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

                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

                            } else if (format === 'ddd') {
                                ii = indexOf.call(this._shortWeekdaysParse, llc);
                                if (ii !== -1) {
                                    return ii;
                                }
                Severity: Major
                Found in resources/lib/moment/moment.js and 1 other location - About 3 hrs to fix
                resources/lib/moment/moment.js on lines 1605..1638

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

                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

                    public function __construct(
                        LinkBatchFactory $linkBatchFactory,
                        IContentHandlerFactory $contentHandlerFactory,
                        GroupPermissionsLookup $groupPermissionsLookup,
                        RevisionLookup $revisionLookup,
                Severity: Major
                Found in includes/specials/SpecialNewPages.php and 1 other location - About 3 hrs to fix
                includes/specials/SpecialBlockList.php on lines 67..89

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

                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

                    public function __construct(
                        LinkBatchFactory $linkBatchFactory,
                        DatabaseBlockStore $blockStore,
                        BlockRestrictionStore $blockRestrictionStore,
                        IConnectionProvider $dbProvider,
                Severity: Major
                Found in includes/specials/SpecialBlockList.php and 1 other location - About 3 hrs to fix
                includes/specials/SpecialNewPages.php on lines 82..103

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

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

                    mw.widgets.datetime.ProlepticGregorianDateTimeFormatter.static.setupDefaults = function () {
                        mw.widgets.datetime.DateTimeFormatter.static.setupDefaults.call( this );
                
                        if ( this.fullMonthNames && !this.shortMonthNames ) {
                            this.shortMonthNames = {};

                  Function conditionParse has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function conditionParse( $root, spec ) {
                      let v, fields, func;
                  
                      const op = spec[ 0 ];
                      let l = spec.length;
                  Severity: Major
                  Found in resources/src/mediawiki.htmlform/cond-state.js - About 3 hrs to fix

                    Function step has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                  function step() {
                                    if (canceled) return reject('canceled');
                                    var startMs = Date.now();
                    
                                    // This code is copy/pasted 3 times for performance reasons [options.keys, options.key, no keys]
                    Severity: Major
                    Found in resources/lib/qunitjs/qunit.js - About 3 hrs to fix

                      Function trigger has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          trigger: function( event, data, elem, onlyHandlers ) {
                      
                              var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
                                  eventPath = [ elem || document ],
                                  type = hasOwn.call( event, "type" ) ? event.type : event,
                      Severity: Major
                      Found in resources/lib/jquery/jquery.js - About 3 hrs to fix

                        Method doModify has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function doModify( CommentStoreComment $summary ): PageUpdateStatus {
                                $wikiPage = $this->getWikiPage(); // TODO: use for legacy hooks only!
                        
                                // Update article, but only if changed.
                                $status = PageUpdateStatus::newEmpty( false );
                        Severity: Major
                        Found in includes/Storage/PageUpdater.php - About 3 hrs to fix

                          Method newLoad has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function newLoad(
                                  $specificTarget,
                                  $specificType,
                                  $fromPrimary,
                                  $vagueTarget = null
                          Severity: Major
                          Found in includes/block/DatabaseBlockStore.php - About 3 hrs to fix

                            Method getTitle has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function getTitle() {
                                    if ( $this->mTitle !== false ) {
                                        return $this->mTitle;
                                    }
                                    if ( !is_string( $this->mDesiredDestName ) ) {
                            Severity: Major
                            Found in includes/upload/UploadBase.php - About 3 hrs to fix

                              Method getNearMatchInternal has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function getNearMatchInternal( $searchterm ) {
                                      $allSearchTerms = [ $searchterm ];
                              
                                      if ( $this->languageConverter->hasVariants() ) {
                                          $allSearchTerms = array_unique( array_merge(
                              Severity: Major
                              Found in includes/search/TitleMatcher.php - About 3 hrs to fix

                                Method updateActiveUsers has 94 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    protected function updateActiveUsers() {
                                        $activeUserDays = MediaWikiServices::getInstance()->getMainConfig()->get(
                                            MainConfigNames::ActiveUserDays );
                                
                                        // Users that made edits at least this many days ago are "active"
                                Severity: Major
                                Found in includes/recentchanges/RecentChangesUpdateJob.php - About 3 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language