wikimedia/mediawiki-core

View on GitHub

Showing 11,498 of 11,498 total issues

Function newFromId has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function newFromId( $id ): BagOStuff {
        if ( $id === CACHE_ANYTHING ) {
            $id = $this->getAnythingId();
        }

Severity: Minor
Found in includes/objectcache/ObjectCacheFactory.php - About 25 mins 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 getPageGroups has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function getPageGroups() {
        $pages = $this->getSpecialPageFactory()->getUsablePages( $this->getUser() );

        if ( $pages === [] ) {
            // Yeah, that was pointless. Thanks for coming.
Severity: Minor
Found in includes/specials/SpecialSpecialPages.php - About 25 mins 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 getRandomTitle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getRandomTitle() {
        // Convert to float, since we do math with the random number.
        $rand = (float)wfRandom();

        // Given that timestamps are rather unevenly distributed, we also
Severity: Minor
Found in includes/specials/SpecialRandomInCategory.php - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $params = $this->extractRequestParams();
        $token = $params['token'];
        $maxage = $params['maxtokenage'];
        $salts = ApiQueryTokens::getTokenTypeSalts();
Severity: Minor
Found in includes/api/ApiCheckToken.php - About 25 mins 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 createTables has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function createTables() {
        foreach ( $this->getShardServerIndexes() as $shardIndex ) {
            $db = $this->getConnection( $shardIndex );
            if ( in_array( $db->getType(), [ 'mysql', 'postgres' ], true ) ) {
                for ( $i = 0; $i < $this->numTableShards; $i++ ) {
Severity: Minor
Found in includes/objectcache/SqlBagOStuff.php - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute( $par ) {
        $this->setHeaders();
        $this->outputHeader();

        $out = $this->getOutput();
Severity: Minor
Found in includes/specials/SpecialListGrants.php - About 25 mins 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 newFromParams has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function newFromParams( array $params ): BagOStuff {
        $logger = $this->logger->getLogger( $params['loggroup'] ?? 'objectcache' );
        // Apply default parameters and resolve the logger instance
        $params += [
            'logger' => $logger,
Severity: Minor
Found in includes/objectcache/ObjectCacheFactory.php - About 25 mins 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 unserialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function unserialize( $value ) {
        if ( $value === self::TOMB_SERIAL ) {
            return false; // tombstone
        }

Severity: Minor
Found in includes/objectcache/SqlBagOStuff.php - About 25 mins 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 checkExtensionExistence has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    function checkExtensionExistence() {
        $missingExtensions = array();
        foreach ( $this->functionsExtensionsMapping as $function => $extension ) {
            if ( !function_exists( $function ) ) {
                $missingExtensions[] = $extension;
Severity: Minor
Found in includes/PHPVersionCheck.php - About 25 mins 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 redirectToRevDel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function redirectToRevDel() {
        $revisions = [];

        foreach ( $this->getRequest()->getValues() as $key => $val ) {
            $matches = [];
Severity: Minor
Found in includes/specials/SpecialUndelete.php - About 25 mins 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 getGroupStats has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function getGroupStats() {
        $linkRenderer = $this->getLinkRenderer();
        $lang = $this->getLanguage();
        $text = '';
        foreach ( $this->userGroupManager->listAllGroups() as $group ) {
Severity: Minor
Found in includes/specials/SpecialStatistics.php - About 25 mins 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 getLocalServerCacheClass has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static function getLocalServerCacheClass() {
        if ( self::$localServerCacheClass !== null ) {
            return self::$localServerCacheClass;
        }
        if ( function_exists( 'apcu_fetch' ) ) {
Severity: Minor
Found in includes/objectcache/ObjectCacheFactory.php - About 25 mins 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 doHeader has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function doHeader( $opts, $numRows ) {
        $user = $this->getUser();
        $out = $this->getOutput();
        $skin = $this->getSkin();
        // For legacy skins render the tabs in the subtitle
Severity: Minor
Found in includes/specials/SpecialWatchlist.php - About 25 mins 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 changePageLanguage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function changePageLanguage( IContextSource $context, Title $title,
        $newLanguage, $reason = "", array $tags = [], IDatabase $dbw = null ) {
        // Get the default language for the wiki
        $defLang = $context->getConfig()->get( MainConfigNames::LanguageCode );

Severity: Minor
Found in includes/specials/SpecialPageLanguage.php - About 25 mins 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 fetchOptionsFromRequest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function fetchOptionsFromRequest( $opts ) {
        static $compatibilityMap = [
            'hideMinor' => 'hideminor',
            'hideBots' => 'hidebots',
            'hideAnons' => 'hideanons',
Severity: Minor
Found in includes/specials/SpecialWatchlist.php - About 25 mins 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 getLinks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getLinks( $inputPages, $pageSet, SelectQueryBuilder $queryBuilder ) {
        foreach ( $inputPages as $page ) {
            $title = Title::newFromText( $page );
            if ( $title ) {
                $pageSet[$title->getPrefixedText()] = true;
Severity: Minor
Found in includes/specials/SpecialExport.php - About 25 mins 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 getNamespaceKeyAndText has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getNamespaceKeyAndText( $ns, $text ) {
        if ( $text == '' ) {
            # shortcut for common case
            return [ $ns, '', '' ];
        }
Severity: Minor
Found in includes/specials/SpecialAllPages.php - About 25 mins 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 getMoveStatusHtml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function getMoveStatusHtml( Status $status, Title $oldTitle, Title $newTitle ) {
        $linkRenderer = $this->getLinkRenderer();
        if ( $status->hasMessage( 'articleexists' ) || $status->hasMessage( 'redirectexists' ) ) {
            $link = $linkRenderer->makeKnownLink( $newTitle );
            return Html::rawElement(
Severity: Minor
Found in includes/specials/SpecialRenameUser.php - About 25 mins 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 getWatchCheck has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getWatchCheck() {
        $user = $this->getUser();
        if ( $this->userOptionsLookup->getBoolOption( $user, 'watchdefault' ) ) {
            // Watch all edits!
            return true;
Severity: Minor
Found in includes/specials/SpecialUpload.php - About 25 mins 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 showList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function showList( BlockListPager $pager ) {
        $out = $this->getOutput();

        # Check for other blocks, i.e. global/tor blocks
        $otherAutoblockLink = [];
Severity: Minor
Found in includes/specials/SpecialAutoblockList.php - About 25 mins 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