wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Function doAllOrphans has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function doAllOrphans() {
        $dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
        $startId = 0;
        $i = 0;
        if ( $this->noCount ) {
Severity: Minor
Found in maintenance/storage/recompressTracked.php - About 2 hrs 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 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $dbr = $this->getReplicaDB();

        $endId = $dbr->newSelectQueryBuilder()
            ->select( 'MAX(old_id)' )
Severity: Minor
Found in maintenance/storage/storageTypeStats.php - About 2 hrs 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 getUserIdentityFromAnyId has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function getUserIdentityFromAnyId(
        $userId,
        $userName,
        $actorId = null
    ): UserIdentity {
Severity: Minor
Found in includes/recentchanges/RecentChange.php - About 2 hrs 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 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        // Note that there is a difference between not specifying the start
        // and end IDs and using the minimum and maximum values from the page
        // table. In the latter case, deleteLinksFromNonexistent() will not
        // delete entries for nonexistent IDs that fall outside the range.
Severity: Minor
Found in maintenance/refreshLinks.php - About 2 hrs 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 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $errors = [];
        $destinationFolder = $this->getArg( 0 );
        if ( !is_dir( $destinationFolder ) || !is_writable( $destinationFolder ) ) {
            $errors[] = "The path: $destinationFolder does not exist, is not a folder or is not writable.";
Severity: Minor
Found in maintenance/convertExtensionsMessagesToTranslationAlias.php - About 2 hrs 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 prune_directory has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected function prune_directory( $dir, $report = false ) {
        $tsNow = time();
        $dirHandle = opendir( $dir );
        // phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
        while ( ( $file = readdir( $dirHandle ) ) !== false ) {
Severity: Minor
Found in maintenance/pruneFileCache.php - About 2 hrs 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 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $username = $this->getOption( 'user' );
        $file = $this->getOption( 'file' );

        if ( $username === null && $file === null ) {
Severity: Minor
Found in maintenance/invalidateUserSessions.php - About 2 hrs 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 doPurge has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function doPurge() {
        $stdin = $this->getStdin();
        $urls = [];
        $htmlCacheUpdater = $this->getServiceContainer()->getHtmlCacheUpdater();

Severity: Minor
Found in maintenance/purgeList.php - About 2 hrs 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 lazyMenuCreation has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

MenuSelectWidget.prototype.lazyMenuCreation = function () {
    const widget = this,
        items = [],
        viewGroupCount = {},
        groups = this.model.getFilterGroups();
Severity: Major
Found in resources/src/mediawiki.rcfilters/ui/MenuSelectWidget.js - About 2 hrs to fix

    Function initialize has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        mw.ForeignStructuredUpload.BookletLayout.prototype.initialize = function () {
            const booklet = this;
            return mw.ForeignStructuredUpload.BookletLayout.super.prototype.initialize.call( this ).then(
                () => $.when(
                    // Point the CategoryMultiselectWidget to the right wiki

      Function MwWidgetsTitleOptionWidget has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          mw.widgets.TitleOptionWidget = function MwWidgetsTitleOptionWidget( config ) {
              let icon;
      
              if ( !config.showImages ) {
                  icon = null;
      Severity: Major
      Found in resources/src/mediawiki.widgets/mw.widgets.TitleOptionWidget.js - About 2 hrs to fix

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

        function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
          const _component_cdx_text_input = resolveComponent("cdx-text-input");
          const _component_cdx_menu = resolveComponent("cdx-menu");
          return openBlock(), createElementBlock(
            "div",
        Severity: Major
        Found in resources/lib/codex/codex.js - About 2 hrs to fix

          Function makeApi has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function makeApi(sinon) {
                  var slice = Array.prototype.slice;
          
                  function test(callback) {
                      var type = typeof callback;
          Severity: Major
          Found in resources/lib/sinonjs/sinon.js - About 2 hrs to fix

            Function remove has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                remove: function( elem, types, handler, selector, mappedTypes ) {
            
                    var j, origCount, tmp,
                        events, t, handleObj,
                        special, handlers, type, namespaces, origType,
            Severity: Major
            Found in resources/lib/jquery/jquery.js - About 2 hrs to fix

              Function _refreshValue has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  _refreshValue: function() {
                      var lastValPercent, valPercent, value, valueMin, valueMax,
                          oRange = this.options.range,
                          o = this.options,
                          that = this,
              Severity: Major
              Found in resources/lib/jquery.ui/jquery.ui.slider.js - About 2 hrs to fix

                Function _processTabs has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _processTabs: function() {
                        var that = this;
                
                        this.tablist = this._getList()
                            .addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
                Severity: Major
                Found in resources/lib/jquery.ui/jquery.ui.tabs.js - About 2 hrs to fix

                  Function getElementClasses has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  OO.ui.WikimediaUITheme.prototype.getElementClasses = function ( element ) {
                      const
                          variants = {
                              invert: false,
                              progressive: false,
                  Severity: Major
                  Found in resources/lib/ooui/oojs-ui-wikimediaui.js - About 2 hrs to fix

                    Function keydown has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                keydown: function( event ) {
                                    if ( this.element.prop( "readOnly" ) ) {
                                        suppressKeyPress = true;
                                        suppressInput = true;
                                        suppressKeyPressRepeat = true;
                    Severity: Major
                    Found in resources/lib/jquery.ui/jquery.ui.autocomplete.js - About 2 hrs to fix

                      Function _mouseStart has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          _mouseStart: function(event) {
                              var that = this;
                      
                              this.opos = [event.pageX, event.pageY];
                      
                      
                      Severity: Major
                      Found in resources/lib/jquery.ui/jquery.ui.selectable.js - About 2 hrs to fix

                        Function _computeTargetAndRootIntersection has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function(target, targetRect, rootRect) {
                          // If the element isn't displayed, an intersection can't happen.
                          if (window.getComputedStyle(target).display == 'none') return;
                        
                          var intersectionRect = targetRect;
                        Severity: Major
                        Found in resources/lib/intersection-observer/intersection-observer.js - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language