wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Function wfResetOutputBuffers has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function wfResetOutputBuffers( $resetGzipEncoding = true ) {
    // phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition
    while ( $status = ob_get_status() ) {
        if ( isset( $status['flags'] ) ) {
            $flags = PHP_OUTPUT_HANDLER_CLEANABLE | PHP_OUTPUT_HANDLER_REMOVABLE;
Severity: Minor
Found in includes/GlobalFunctions.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 wfThumbIsStandard has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function wfThumbIsStandard( File $file, array $params ) {
    global $wgThumbLimits, $wgImageLimits, $wgResponsiveImages;

    $multipliers = [ 1 ];
    if ( $wgResponsiveImages ) {
Severity: Minor
Found in includes/GlobalFunctions.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 recache has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function recache( $limit, $unused = true ) {
        if ( !$this->isCacheable() ) {
            return 0;
        }

Severity: Minor
Found in includes/specialpage/QueryPage.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 useFileCache has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public static function useFileCache( IContextSource $context, $mode = self::MODE_NORMAL ) {
        $services = MediaWikiServices::getInstance();
        $config = $services->getMainConfig();

        if ( !$config->get( MainConfigNames::UseFileCache ) && $mode !== self::MODE_REBUILD ) {
Severity: Minor
Found in includes/cache/HTMLFileCache.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 getDefaultText has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getDefaultText() {
        if ( !$this->values['wgImageMagickConvertCommand'] ) {
            $this->values['wgImageMagickConvertCommand'] = '/usr/bin/convert';
            $magic = '#';
        } else {
Severity: Minor
Found in includes/installer/LocalSettingsGenerator.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 submit has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function submit() {
        $status = $this->submitWebUserBox();
        if ( !$status->isOK() ) {
            return $status;
        }
Severity: Minor
Found in includes/installer/PostgresSettingsForm.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 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $pages = $this->getPageSet()->getGoodPages();
        if ( $pages === [] ) {
            return;
        }
Severity: Minor
Found in includes/api/ApiQueryExternalLinks.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 getInvalidTitlesAndRevisions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function getInvalidTitlesAndRevisions( $invalidChecks = [ 'invalidTitles',
        'special', 'missingIds', 'missingRevIds', 'missingTitles', 'interwikiTitles' ]
    ) {
        $result = [];
        if ( in_array( 'invalidTitles', $invalidChecks ) ) {
Severity: Minor
Found in includes/api/ApiPageSet.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 recAutopromote has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private function recAutopromote( $cond, $allowedConditions ) {
        $config = [];
        // First, checks if $cond is an array
        if ( is_array( $cond ) ) {
            // Checks if $cond[0] is a valid operand
Severity: Minor
Found in includes/api/ApiQuerySiteinfo.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 deleteObjectsExpiringBefore has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function deleteObjectsExpiringBefore(
        $timestamp,
        callable $progress = null,
        $limit = INF,
        string $tag = null
Severity: Minor
Found in includes/objectcache/SqlBagOStuff.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 formatPermissions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private function formatPermissions( $permissions, $revoke, $add, $remove, $addSelf, $removeSelf ) {
        $r = [];
        foreach ( $permissions as $permission ) {
            // show as granted only if it isn't revoked to prevent duplicate display of permissions
            if ( !isset( $revoke[$permission] ) || !$revoke[$permission] ) {
Severity: Minor
Found in includes/specials/SpecialListGroupRights.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 getOtherStats has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private function getOtherStats( array $stats ) {
        $return = '';

        foreach ( $stats as $header => $items ) {
            // Identify the structure used
Severity: Minor
Found in includes/specials/SpecialStatistics.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 doSaveUserGroups has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function doSaveUserGroups( $user, array $add, array $remove, string $reason = '',
        array $tags = [], array $groupExpiries = []
    ) {
        // Validate input set...
        $isself = $user->getName() == $this->getUser()->getName();
Severity: Minor
Found in includes/specials/SpecialUserRights.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 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute( $subpage ) {
        $this->setHeaders();
        $this->addHelpLink( 'Help:ExpandTemplates' );

        $request = $this->getRequest();
Severity: Minor
Found in includes/specials/SpecialExpandTemplates.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 doTagRow has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private function doTagRow(
        $tag, $hitcount, $showManageActions, $showDeleteActions, $showEditLinks
    ) {
        $newRow = '';
        $newRow .= Xml::tags( 'td', null, Xml::element( 'code', null, $tag ) );
Severity: Minor
Found in includes/specials/SpecialTags.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 getFormFields has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getFormFields() {
        $fields = [];

        if ( $this->par !== null ) {
            $this->botPassword = BotPassword::newFromCentralId( $this->userId, $this->par );
Severity: Minor
Found in includes/specials/SpecialBotPasswords.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 output has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public static function output( Throwable $e, $mode, Throwable $eNew = null ) {
        $showExceptionDetails = self::shouldShowExceptionDetails();
        if ( $e instanceof RequestTimeoutException && headers_sent() ) {
            // Excimer's flag check happens on function return, so, a timeout
            // can be thrown after exiting, say, `doPostOutputShutdown`, where
Severity: Minor
Found in includes/exception/MWExceptionRenderer.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 extractTagsAndParams has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public static function extractTagsAndParams( array $elements, $text, &$matches ) {
        static $n = 1;
        $stripped = '';
        $matches = [];

Severity: Minor
Found in includes/parser/Parser.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 getImageParams has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private function getImageParams( $handler ) {
        if ( $handler ) {
            $handlerClass = get_class( $handler );
        } else {
            $handlerClass = '';
Severity: Minor
Found in includes/parser/Parser.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 interwikiMap has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function interwikiMap(): array {
        // Unfortunate that this mostly duplicates \ApiQuerySiteinfo::appendInterwikiMap()
        if ( $this->interwikiMap !== null ) {
            return $this->interwikiMap;
        }
Severity: Minor
Found in includes/parser/Parsoid/Config/SiteConfig.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