wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Method mergeInternalMetaDataFrom has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function mergeInternalMetaDataFrom( ParserOutput $source ): void {
        $this->mWarnings = self::mergeMap( $this->mWarnings, $source->mWarnings ); // don't use getter
        $this->mTimestamp = $this->useMaxValue( $this->mTimestamp, $source->getRevisionTimestamp() );
        if ( $source->hasCacheTime() ) {
            $sourceCacheTime = $source->getCacheTime();
Severity: Major
Found in includes/parser/ParserOutput.php - About 2 hrs to fix

    Method __construct has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __construct(
            ServiceOptions $svcOptions,
            MagicWordFactory $magicWordFactory,
            Language $contLang,
            ParserFactory $factory,
    Severity: Major
    Found in includes/parser/Parser.php - About 2 hrs to fix

      Method logLine has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function logLine( $row ) {
              $entry = DatabaseLogEntry::newFromRow( $row );
              $formatter = $this->logFormatterFactory->newFromEntry( $entry );
              $formatter->setContext( $this->getContext() );
              $formatter->setShowUserToolLinks( !( $this->flags & self::NO_EXTRA_USER_LINKS ) );
      Severity: Major
      Found in includes/logging/LogEventsList.php - About 2 hrs to fix

        Method loadFromRow has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function loadFromRow( $row, $prefix = 'img_' ) {
                $this->dataLoaded = true;
        
                $unprefixed = $this->unprefixRow( $row, $prefix );
        
        
        Severity: Major
        Found in includes/filerepo/file/LocalFile.php - About 2 hrs to fix

          Method getFileInfo has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function getFileInfo( $file, Authority $performer, $transforms ) {
                  $urlUtils = MediaWikiServices::getInstance()->getUrlUtils();
                  // If there is a problem with the file, there is very little info we can reliably
                  // return (T228286, T239213), but we do what we can (T201205).
                  $responseFile = [
          Severity: Major
          Found in includes/filerepo/file/MediaFileTrait.php - About 2 hrs to fix

            Method doPage has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function doPage( $pageId ) {
                    $title = Title::newFromID( $pageId );
                    if ( $title ) {
                        $titleText = $title->getPrefixedText();
                    } else {
            Severity: Major
            Found in maintenance/storage/recompressTracked.php - About 2 hrs to fix

              Method loadThing has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function loadThing( &$dependencies, $name, $extensions, $skins ) {
                      $extDir = $this->getConfig()->get( MainConfigNames::ExtensionDirectory );
                      $styleDir = $this->getConfig()->get( MainConfigNames::StyleDirectory );
                      $queue = [];
                      $missing = false;
              Severity: Major
              Found in maintenance/checkDependencies.php - About 2 hrs to fix

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

                    public function execute() {
                        global $IP;
                
                        $platform = $this->getOption( 'type', 'mysql' );
                        $jsonPath = $this->getOption( 'json', dirname( __DIR__ ) );
                Severity: Major
                Found in maintenance/includes/SchemaMaintenance.php - About 2 hrs to fix

                  Method generateMessageFileList has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function generateMessageFileList( array $setupFiles ) {
                          $IP = MW_INSTALL_PATH;
                  
                          $outputFile = $this->getOption( 'output' );
                          $quiet = $this->hasOption( 'quiet' );
                  Severity: Major
                  Found in maintenance/mergeMessageFileList.php - About 2 hrs to fix

                    Method doAllOrphans has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function doAllOrphans() {
                            $dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
                            $startId = 0;
                            $i = 0;
                            if ( $this->noCount ) {
                    Severity: Major
                    Found in maintenance/storage/recompressTracked.php - About 2 hrs to fix

                      Method mungeTitle has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function mungeTitle( IReadableDatabase $db, Title $oldTitle, Title &$newTitle ) {
                              $nt = $newTitle->getPrefixedText();
                      
                              $munge = false;
                              if ( $this->isUserPage( $db, $newTitle->getNamespace(), $newTitle->getText() ) ) {
                      Severity: Major
                      Found in maintenance/uppercaseTitlesForUnicodeTransition.php - About 2 hrs to fix

                        Method doDBUpdates has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function doDBUpdates() {
                                $this->output( "Fixing log entries with log_title starting with 'User:#'\n" );
                        
                                $dbr = $this->getReplicaDB();
                                $dbw = $this->getPrimaryDB();
                        Severity: Major
                        Found in maintenance/fixAutoblockLogTitles.php - About 2 hrs to fix

                          Method purgeFromLogType has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function purgeFromLogType( $type ) {
                                  $repo = $this->getServiceContainer()->getRepoGroup()->getLocalRepo();
                                  $dbr = $this->getReplicaDB();
                          
                                  foreach ( self::$typeMappings[$type] as $logType => $logActions ) {
                          Severity: Major
                          Found in maintenance/purgeChangedFiles.php - About 2 hrs to fix

                            Method cleanupArticle has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function cleanupArticle( $id, $domain, $protocol, Authority $performer ) {
                                    $title = Title::newFromID( $id );
                                    if ( !$title ) {
                                        $this->error( "Internal error: no page for ID $id" );
                            
                            
                            Severity: Major
                            Found in maintenance/cleanupSpam.php - About 2 hrs to fix

                              Method movePage has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private function movePage( $id, LinkTarget $newLinkTarget ) {
                                      $dbw = $this->getPrimaryDB();
                              
                                      $dbw->newUpdateQueryBuilder()
                                          ->update( 'page' )
                              Severity: Major
                              Found in maintenance/namespaceDupes.php - About 2 hrs to fix

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

                                    if ( this.selected !== state ) {
                                        this.selected = state;
                                        this.$input.prop( 'checked', this.selected );
                                        if ( !internal ) {
                                            this.setIndeterminate( false, true );
                                Severity: Major
                                Found in resources/lib/ooui/oojs-ui-core.js and 1 other location - About 2 hrs to fix
                                resources/lib/ooui/oojs-ui-core.js on lines 10499..10506

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

                                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

                                OO.ui.WindowInstance.prototype.isOpened = function () {
                                    return this.deferreds.opened.state() === 'resolved' &&
                                        this.deferreds.closing.state() === 'pending';
                                };
                                Severity: Major
                                Found in resources/lib/ooui/oojs-ui-windows.js and 1 other location - About 2 hrs to fix
                                resources/lib/ooui/oojs-ui-windows.js on lines 942..945

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

                                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

                                            yieldsRight: function () {
                                                this.callArgAt = useRightMostCallback;
                                                this.callbackArguments = slice.call(arguments, 0);
                                                this.callbackContext = undefined;
                                                this.callArgProp = undefined;
                                Severity: Major
                                Found in resources/lib/sinonjs/sinon.js and 1 other location - About 2 hrs to fix
                                resources/lib/sinonjs/sinon.js on lines 3354..3362

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

                                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

                                            yields: function () {
                                                this.callArgAt = useLeftMostCallback;
                                                this.callbackArguments = slice.call(arguments, 0);
                                                this.callbackContext = undefined;
                                                this.callArgProp = undefined;
                                Severity: Major
                                Found in resources/lib/sinonjs/sinon.js and 1 other location - About 2 hrs to fix
                                resources/lib/sinonjs/sinon.js on lines 3364..3372

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

                                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

                                        put: function ( path, body, headers ) {
                                            headers = objectKeysToLowerCase( headers );
                                            return this.ajax( path, {
                                                type: 'PUT',
                                                headers: Object.assign( headers, { 'content-type': 'application/json' } ),
                                Severity: Major
                                Found in resources/src/mediawiki.api/rest.js and 1 other location - About 2 hrs to fix
                                resources/src/mediawiki.api/rest.js on lines 161..168

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

                                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