wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Method sendCacheHeaders has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function sendCacheHeaders( $isError ) {
        $response = $this->getRequest()->response();
        $out = $this->getOutput();

        $out->addVaryHeader( 'Treat-as-Untrusted' );
Severity: Major
Found in includes/api/ApiMain.php - About 2 hrs to fix

    Method populateGeneratorData has 69 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function populateGeneratorData( &$result, array $path = [] ) {
            if ( $result instanceof ApiResult ) {
                $data = $result->getResultData( $path );
                if ( $data === null ) {
                    return true;
    Severity: Major
    Found in includes/api/ApiPageSet.php - About 2 hrs to fix

      Method outputNamespaceProtectionInfo has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function outputNamespaceProtectionInfo() {
              $out = $this->getOutput();
              $namespaceProtection = $this->getConfig()->get( MainConfigNames::NamespaceProtection );
      
              if ( count( $namespaceProtection ) == 0 ) {
      Severity: Major
      Found in includes/specials/SpecialListGroupRights.php - About 2 hrs to fix

        Method getNormalForm has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function getNormalForm() {
                $fields = [];
                $count = 0;
        
                // Allow subscribers to manipulate the list of watched pages (or use it
        Severity: Major
        Found in includes/specials/SpecialEditWatchlist.php - About 2 hrs to fix

          Method callParserFunction has 69 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function callParserFunction( PPFrame $frame, $function, array $args = [] ) {
                  # Case sensitive functions
                  if ( isset( $this->mFunctionSynonyms[1][$function] ) ) {
                      $function = $this->mFunctionSynonyms[1][$function];
                  } else {
          Severity: Major
          Found in includes/parser/Parser.php - About 2 hrs to fix

            Method formatChangeLine has 69 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function formatChangeLine( RecentChange $rc, array &$classes, $watched ) {
                    $html = '';
                    $unpatrolled = $this->showAsUnpatrolled( $rc );
            
                    if ( $rc->mAttribs['rc_log_type'] ) {
            Severity: Major
            Found in includes/recentchanges/OldChangesList.php - About 2 hrs to fix

              Method rebuildRecentChangesTablePass2 has 69 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function rebuildRecentChangesTablePass2() {
                      $dbw = $this->getPrimaryDB();
              
                      $this->output( "Updating links and size differences...\n" );
              
              
              Severity: Major
              Found in maintenance/rebuildrecentchanges.php - About 2 hrs to fix

                Method doMove has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function doMove( IDatabase $db, $ns, $title ) {
                        $char = mb_substr( $title, 0, 1 );
                        if ( !array_key_exists( $char, $this->charmap ) ) {
                            $this->error(
                                "Query returned NS$ns $title, which does not begin with a character in the charmap."
                Severity: Major
                Found in maintenance/uppercaseTitlesForUnicodeTransition.php - About 2 hrs to fix

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

                      public function execute() {
                          $dbw = $this->getPrimaryDB();
                          $dbr = $this->getReplicaDB();
                          $maxLtId = (int)$dbr->newSelectQueryBuilder()
                              ->select( 'MAX(lt_id)' )
                  Severity: Major
                  Found in maintenance/pruneUnusedLinkTargetRows.php - About 2 hrs to fix

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

                        public function execute() {
                            $this->init();
                            $batchSize = $this->getBatchSize();
                    
                            if ( $this->targetTable ) {
                    Severity: Major
                    Found in maintenance/updateCollation.php - About 2 hrs to fix

                      Function addPortletLink has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                          addPortletLink: function ( portletId, href, text, id, tooltip, accesskey, nextnode ) {
                              if ( !portletId ) {
                                  // Avoid confusing id="undefined" lookup
                                  return null;
                              }
                      Severity: Minor
                      Found in resources/src/mediawiki.util/util.js - 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 set has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                          set: function ( fn, delay ) {
                              let nativeId = null,
                                  visibleId = nextId++,
                                  lastStartedAt = mw.now();
                      
                      
                      Severity: Minor
                      Found in resources/src/mediawiki.visibleTimeout/visibleTimeout.js - 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 initialize has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                      Controller.prototype.initialize = function ( filterStructure, namespaceStructure, tagList, conditionalViews ) {
                          const displayConfig = mw.config.get( 'StructuredChangeFiltersDisplayConfig' ),
                              defaultSavedQueryExists = mw.config.get( 'wgStructuredChangeFiltersDefaultSavedQueryExists' ),
                              controller = this,
                              views = $.extend( true, {}, conditionalViews ),
                      Severity: Minor
                      Found in resources/src/mediawiki.rcfilters/Controller.js - 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 getCascadeProtectionSourcesInternal has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function getCascadeProtectionSourcesInternal(
                              PageIdentity $page, bool $shortCircuit = false
                          ) {
                              if ( !$page->canExist() ) {
                                  return $shortCircuit ? false : [ [], [] ];
                      Severity: Minor
                      Found in includes/Permissions/RestrictionStore.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 showMissingArticle has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function showMissingArticle() {
                              $context = $this->getContext();
                              $send404Code = $context->getConfig()->get( MainConfigNames::Send404Code );
                      
                              $outputPage = $context->getOutput();
                      Severity: Minor
                      Found in includes/page/Article.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 deleteInternal has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function deleteInternal(
                              WikiPage $page,
                              string $pageRole,
                              string $reason,
                              ?string $webRequestId = null
                      Severity: Minor
                      Found in includes/page/DeletePage.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 getBody has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getBody() {
                              $s = '';
                              $this->doQuery();
                              if ( count( $this->mHist ) ) {
                                  if ( $this->mImg->isLocal() ) {
                      Severity: Minor
                      Found in includes/page/ImageHistoryPseudoPager.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 getGoodIDs has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function getGoodIDs( $titles ) {
                              $result = [];
                              if ( is_iterable( $titles ) ) {
                                  if ( $titles instanceof TitleArrayFromResult ||
                                      ( is_array( $titles ) && reset( $titles ) instanceof Title
                      Severity: Minor
                      Found in includes/page/PageProps.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 continueLinkAttempt has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function continueLinkAttempt( $user, $key, array $reqs ) {
                              $req = ButtonAuthenticationRequest::getRequestByName( $reqs, 'linkOk' );
                              if ( $req ) {
                                  return AuthenticationResponse::newPass();
                              }
                      Severity: Minor
                      Found in includes/auth/ConfirmLinkSecondaryAuthenticationProvider.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 processUser has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function processUser( string $value ): array {
                              // A user ID?
                              if ( preg_match( '/^#(\d+)$/D', $value, $m ) ) {
                                  // This used to use the IP address of the current request if the
                                  // id was 0, to match the behavior of User objects, but was switched
                      Severity: Minor
                      Found in includes/ParamValidator/TypeDef/UserDef.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

                      Severity
                      Category
                      Status
                      Source
                      Language