wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Method insert has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function insert( $data, array $params = [], array $tryStores = null ) {
        $tryStores ??= $this->storeFactory->getWriteBaseUrls();
        if ( !$tryStores ) {
            throw new ExternalStoreException( "List of external stores provided is empty." );
        }
Severity: Minor
Found in includes/externalstore/ExternalStoreAccess.php - About 1 hr to fix

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

        public function __construct( array $config = [] ) {
            $config = array_merge( [
                // Default config values
                'precision' => 'day',
                'longDisplayFormat' => false,
    Severity: Minor
    Found in includes/widget/DateInputWidget.php - About 1 hr to fix

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

          public function __construct( LanguageFactory $languageFactory ) {
              parent::__construct(
                  $languageFactory,
                  [
                      'А',
      Severity: Minor
      Found in includes/collation/BashkirUppercaseCollation.php - About 1 hr to fix

        Method notifyNew has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function notifyNew(
                $timestamp,
                $page, $minor, $user, $comment, $bot,
                $ip = '', $size = 0, $newId = 0, $patrol = 0, $tags = []
            ) {
        Severity: Minor
        Found in includes/recentchanges/RecentChange.php - About 1 hr to fix

          Method importFromHandle has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function importFromHandle( $handle ) {
                  $this->startTime = microtime( true );
          
                  $user = User::newSystemUser( User::MAINTENANCE_SCRIPT_USER, [ 'steal' => true ] );
          
          
          Severity: Minor
          Found in maintenance/importDump.php - About 1 hr to fix

            Method processUsers has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function processUsers( IReadableDatabase $db ) {
                    $userlistFile = $this->getOption( 'userlist' );
                    if ( $userlistFile === null ) {
                        $this->output( "Not generating user list, --userlist was not specified.\n" );
                        return;
            Severity: Minor
            Found in maintenance/uppercaseTitlesForUnicodeTransition.php - About 1 hr to fix

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

                  public function execute() {
                      $table = $this->getOption( 'table' );
                      $key = $this->getOption( 'key' );
                      $set = $this->getOption( 'set' );
                      $where = $this->getOption( 'where', null );
              Severity: Minor
              Found in maintenance/runBatchedQuery.php - About 1 hr to fix

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

                    public function execute() {
                        $config = $this->getConfig();
                        $objectCaches = $config->get( MainConfigNames::ObjectCaches );
                
                        $cacheType = $this->getOption( 'cache', $config->get( MainConfigNames::MainCacheType ) );
                Severity: Minor
                Found in maintenance/mctest.php - About 1 hr to fix

                  Function exports has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                  module.exports = function ( grunt ) {
                      grunt.loadNpmTasks( 'grunt-banana-checker' );
                      grunt.loadNpmTasks( 'grunt-eslint' );
                      grunt.loadNpmTasks( 'grunt-karma' );
                      grunt.loadNpmTasks( 'grunt-stylelint' );
                  Severity: Minor
                  Found in Gruntfile.js - About 1 hr 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 newFromUserInput has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                  Title.newFromUserInput = function ( title, defaultNamespace, options ) {
                      let namespace = parseInt( defaultNamespace ) || NS_MAIN;
                  
                      // merge options into defaults
                      options = Object.assign( {
                  Severity: Minor
                  Found in resources/src/mediawiki.Title/Title.js - About 1 hr 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 findMatches has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                  FiltersViewModel.prototype.findMatches = function ( query, returnFlat ) {
                      const result = {},
                          flatResult = [],
                          view = this.getViewByTrigger( query.slice( 0, 1 ) ),
                          items = this.getFiltersByView( view );
                  Severity: Minor
                  Found in resources/src/mediawiki.rcfilters/dm/FiltersViewModel.js - About 1 hr 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 getBoundingClientRect has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
                    if (includeScale === void 0) {
                      includeScale = false;
                    }
                    if (isFixedStrategy === void 0) {
                  Severity: Minor
                  Found in resources/lib/codex/codex.js - About 1 hr 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 getAllPrefixesPregenerated has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function getAllPrefixesPregenerated( $local ) {
                          // Lazily resolve site name
                          if ( $this->interwikiScopes >= 3 && !$this->thisSite ) {
                              $this->thisSite = $this->data['__sites:' . $this->wikiId]
                                  ?? $this->options->get( MainConfigNames::InterwikiFallbackSite );
                  Severity: Minor
                  Found in includes/interwiki/ClassicInterwikiLookup.php - About 1 hr 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 fetchRevisionRecord has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function fetchRevisionRecord() {
                          if ( $this->fetchResult ) {
                              return $this->mRevisionRecord;
                          }
                  
                  
                  Severity: Minor
                  Found in includes/page/Article.php - About 1 hr 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 load has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function load(): array {
                          $key = $this->cache->makeGlobalKey(
                              __CLASS__,
                              $this->source->getHashKey()
                          );
                  Severity: Minor
                  Found in includes/Settings/Cache/CachedSource.php - About 1 hr 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 getPackageFiles has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function getPackageFiles( Context $context ): array {
                          $main = null;
                  
                          $files = [];
                          foreach ( $this->getPages( $context ) as $titleText => $options ) {
                  Severity: Minor
                  Found in includes/ResourceLoader/WikiModule.php - About 1 hr 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 addOneModuleResponse has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function addOneModuleResponse(
                          Context $context, MinifierState $minifier, $name, Module $module, &$headers
                      ) {
                          $only = $context->getOnly();
                          $debug = (bool)$context->getDebug();
                  Severity: Minor
                  Found in includes/ResourceLoader/ResourceLoader.php - About 1 hr 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 emitDeprecationWarnings has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function emitDeprecationWarnings() {
                          $deprecatedHooks = $this->registry->getDeprecatedHooks();
                          $extensionHooks = $this->registry->getExtensionHooks();
                  
                          foreach ( $extensionHooks as $name => $handlers ) {
                  Severity: Minor
                  Found in includes/HookContainer/HookContainer.php - About 1 hr 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 getFileHashes has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function getFileHashes( Context $context ) {
                          $files = [];
                  
                          foreach ( $this->getStyleFiles( $context ) as $filePaths ) {
                              foreach ( $filePaths as $filePath ) {
                  Severity: Minor
                  Found in includes/ResourceLoader/FileModule.php - About 1 hr 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 loadFromDefinition has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function loadFromDefinition() {
                          if ( $this->definition === null ) {
                              // Do nothing if definition was already processed
                              return;
                          }
                  Severity: Minor
                  Found in includes/ResourceLoader/OOUIImageModule.php - About 1 hr 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