wikimedia/mediawiki-core

View on GitHub

Showing 9,462 of 11,498 total issues

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

    protected function showConvenienceLinks() {
        $linkRenderer = $this->getLinkRenderer();
        # Give a link to the logs/hist for this page
        if ( $this->targetObj ) {
            // Also set header tabs to be for the target.
Severity: Minor
Found in includes/specials/SpecialRevisionDelete.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 buildMultiUpsertSetForOverwrite has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function buildMultiUpsertSetForOverwrite( IDatabase $db, string $mt ) {
        $expressionsByColumn = [
            'value'   => $db->buildExcludedValue( 'value' ),
            'exptime' => $db->buildExcludedValue( 'exptime' )
        ];
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 addBlockInfoToStatus has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function addBlockInfoToStatus( StatusValue $status, Authority $user = null ) {
        if ( $status instanceof PermissionStatus ) {
            $block = $status->getBlock();
        } else {
            $user = $user ?: $this->getAuthority();
Severity: Minor
Found in includes/api/ApiBase.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 tryShowFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function tryShowFile( $archiveName ) {
        $repo = $this->repoGroup->getLocalRepo();
        $oimage = $repo->newFromArchiveName( $this->targetObj, $archiveName );
        $oimage->load();
        // Check if user is allowed to see this file
Severity: Minor
Found in includes/specials/SpecialRevisionDelete.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 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

Severity
Category
Status
Source
Language