wikimedia/mediawiki-core

View on GitHub

Showing 11,498 of 11,498 total issues

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

    public function getText() {
        $localSettings = $this->getDefaultText();

        if ( count( $this->skins ) ) {
            $localSettings .= "
Severity: Minor
Found in includes/installer/LocalSettingsGenerator.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 loadRequestParameters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function loadRequestParameters() {
        if ( $this->mLoadedRequest ) {
            return;
        }
        $this->mLoadedRequest = true;
Severity: Minor
Found in includes/specialpage/LoginSignupSpecialPage.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 formatResult has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function formatResult( $skin, $result ) {
        $linkRenderer = $this->getLinkRenderer();
        $title = Title::makeTitleSafe( $result->namespace, $result->title );
        if ( $title instanceof Title ) {
            if ( $this->isCached() || $this->forceExistenceCheck() ) {
Severity: Minor
Found in includes/specialpage/WantedQueryPage.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 modifyTable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function modifyTable( $table, $patch, $fullpath = false ) {
        if ( !$this->doTable( $table ) ) {
            return true;
        }

Severity: Minor
Found in includes/installer/DatabaseUpdater.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 stepApplySourceFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function stepApplySourceFile(
        $sourceFileMethod,
        $stepName,
        $tableThatMustNotExist = false
    ) {
Severity: Minor
Found in includes/installer/DatabaseInstaller.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 decodeMessage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static function decodeMessage( $data ) {
        $key = array_shift( $data );
        foreach ( $data as &$param ) {
            if ( is_object( $param ) ) {
                $param = (array)$param;
Severity: Minor
Found in includes/CommentStore/CommentStore.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 loadFromFileCache has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function loadFromFileCache( IContextSource $context, $mode = self::MODE_NORMAL ) {
        wfDebug( __METHOD__ . "()" );
        $filename = $this->cachePath();

        if ( $mode === self::MODE_OUTAGE ) {
Severity: Minor
Found in includes/cache/HTMLFileCache.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 __wakeup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function __wakeup() {
        // addItem() doesn't work if mItems is partially filled from mDiffs
        $this->mFrozen = true;
        $info = HistoryBlobUtils::unserializeArray( gzinflate( $this->mCompressed ) );
        $this->mCompressed = null;
Severity: Minor
Found in includes/historyblob/DiffHistoryBlob.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 setupPLpgSQL has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function setupPLpgSQL() {
        // Connect as the install user, since it owns the database and so is
        // the user that needs to run "CREATE LANGUAGE"
        $status = $this->getPgConnection( 'create-schema' );
        if ( !$status->isOK() ) {
Severity: Minor
Found in includes/installer/PostgresInstaller.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 doQuery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function doQuery( $users, $caller = '' ) {
        $default = $this->getDefault();

        $usersToFetch = [];
        foreach ( (array)$users as $value ) {
Severity: Minor
Found in includes/cache/GenderCache.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 formatIWLinks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function formatIWLinks( $iw ) {
        $result = [];
        foreach ( $iw as $prefix => $titles ) {
            foreach ( $titles as $title => $_ ) {
                $entry = [];
Severity: Minor
Found in includes/api/ApiParse.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 dropTable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function dropTable( $table, $patch = false, $fullpath = false ) {
        if ( !$this->doTable( $table ) ) {
            return true;
        }

Severity: Minor
Found in includes/installer/DatabaseUpdater.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 envCheckMemory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function envCheckMemory() {
        $limit = ini_get( 'memory_limit' );

        if ( !$limit || $limit == -1 ) {
            return true;
Severity: Minor
Found in includes/installer/Installer.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 checkDataDir has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function checkDataDir( $dir ): Status {
        if ( is_dir( $dir ) ) {
            if ( !is_readable( $dir ) ) {
                return Status::newFatal( 'config-sqlite-dir-unwritable', $dir );
            }
Severity: Minor
Found in includes/installer/SqliteInstaller.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() {
        $installer = $this->parent->getDBInstaller( $this->getVar( 'wgDBtype' ) );
        $form = $installer->getSettingsForm( $this->parent );

        $r = $this->parent->request;
Severity: Minor
Found in includes/installer/WebInstallerDBSettings.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 saveToFileCache has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function saveToFileCache( $text ) {
        if ( strlen( $text ) < 512 ) {
            // Disabled or empty/broken output (OOM and PHP errors)
            return $text;
        }
Severity: Minor
Found in includes/cache/HTMLFileCache.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 renameIndex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function renameIndex(
        $table, $old, $new, $skipBothIndexExistWarning = false, $a = false, $b = false
    ) {
        // First requirement: the table must exist
        if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
Severity: Minor
Found in includes/installer/PostgresUpdater.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 getVisitingWatcherInfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function getVisitingWatcherInfo() {
        $config = $this->getConfig();
        $db = $this->getDB();

        $canUnwatchedpages = $this->getAuthority()->isAllowed( 'unwatchedpages' );
Severity: Minor
Found in includes/api/ApiQueryInfo.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 getValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getValue( $name, $default, array $options ) {
        $value = $this->apiMain->getVal( $name, $default );
        $request = $this->apiMain->getRequest();
        $rawValue = $request->getRawVal( $name );

Severity: Minor
Found in includes/api/Validator/ApiParamValidatorCallbacks.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 ifFieldExists has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function ifFieldExists( $table, $field, $func, ...$params ) {
        // Handle $passSelf from runUpdates().
        $passSelf = false;
        if ( $table === $this ) {
            $passSelf = true;
Severity: Minor
Found in includes/installer/DatabaseUpdater.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