wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Function submit has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function submit() {
        // Check edit token on submission
        $request = $this->getRequest();
        $token = $request->getVal( 'wpEditToken' );
        if ( $this->submitClicked && !$this->getUser()->matchEditToken( $token ) ) {
Severity: Minor
Found in includes/specials/SpecialEditTags.php - About 1 hr 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 buildCheckBoxes has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function buildCheckBoxes() {
        // If there is just one item, provide the user with a multi-select field
        $list = $this->getList();
        $tags = [];
        if ( $list->length() == 1 ) {
Severity: Minor
Found in includes/specials/SpecialEditTags.php - About 1 hr 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 buildRollbackLink has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public static function buildRollbackLink(
        RevisionRecord $revRecord,
        IContextSource $context = null,
        $editCount = false
    ) {
Severity: Minor
Found in includes/linker/Linker.php - About 1 hr 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 run has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function run() {
        $ok = true;

        if ( !empty( $this->params['recursive'] ) ) {
            // Job to update all (or a range of) backlink pages for a page
Severity: Minor
Found in includes/jobqueue/jobs/RefreshLinksJob.php - About 1 hr 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 push has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function push( $jobs ) {
        $jobs = is_array( $jobs ) ? $jobs : [ $jobs ];
        if ( $jobs === [] ) {
            return;
        }
Severity: Minor
Found in includes/jobqueue/JobQueueGroup.php - About 1 hr 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 sendCacheControl has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function sendCacheControl() {
        $response = $this->getRequest()->response();
        $config = $this->getConfig();

        $this->addVaryHeader( 'Cookie' );
Severity: Minor
Found in includes/Output/OutputPage.php - About 1 hr 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 mergeInternalMetaDataFrom has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function mergeInternalMetaDataFrom( ParserOutput $source ): void {
        $this->mWarnings = self::mergeMap( $this->mWarnings, $source->mWarnings ); // don't use getter
        $this->mTimestamp = $this->useMaxValue( $this->mTimestamp, $source->getRevisionTimestamp() );
        if ( $source->hasCacheTime() ) {
            $sourceCacheTime = $source->getCacheTime();
Severity: Minor
Found in includes/parser/ParserOutput.php - About 1 hr 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 formatParameterValueForApi has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function formatParameterValueForApi( $name, $type, $value ) {
        $type = strtolower( trim( $type ) );
        switch ( $type ) {
            case 'bool':
                $value = (bool)$value;
Severity: Minor
Found in includes/logging/LogFormatter.php - About 1 hr 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 extractParameters has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function extractParameters() {
        $entry = $this->entry;
        $params = [];

        if ( $entry->isLegacy() ) {
Severity: Minor
Found in includes/logging/LogFormatter.php - About 1 hr 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 loadOptionsFromStore has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function loadOptionsFromStore(
        UserIdentity $user,
        int $queryFlags
    ): array {
        $this->logger->debug( 'Loading options from database',
Severity: Minor
Found in includes/user/Options/UserOptionsManager.php - About 1 hr 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 loadMetadataFromString has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function loadMetadataFromString( $metadataString ) {
        $this->extraDataLoaded = true;
        $this->metadataArray = [];
        $this->metadataBlobs = [];
        $this->unloadedMetadataBlobs = [];
Severity: Minor
Found in includes/filerepo/file/ArchivedFile.php - About 1 hr 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 maybeDoRedirect has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function maybeDoRedirect(
        File $img,
        array $params,
        bool $isTemp,
        bool $isOld,
Severity: Minor
Found in includes/filerepo/ThumbnailEntryPoint.php - About 1 hr 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 loadMetadataFromString has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function loadMetadataFromString( $metadataString ) {
        $this->extraDataLoaded = true;
        $this->metadataArray = [];
        $this->metadataBlobs = [];
        $this->unloadedMetadataBlobs = [];
Severity: Minor
Found in includes/filerepo/file/LocalFile.php - About 1 hr 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 getParserOutput has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function getParserOutput(): ParserOutput {
        if ( !$this->parserOutput ) {
            $parserOptions = ParserOptions::newFromAnon();
            $parserOptions->setRenderReason( __METHOD__ );

Severity: Minor
Found in includes/Rest/Handler/Helper/HtmlOutputRendererHelper.php - About 1 hr 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 flatten has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function flatten( $item ) {
        if ( $item === null ) {
            return '[Null]';
        }

Severity: Minor
Found in includes/debug/logger/LegacyLogger.php - About 1 hr 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 getChangeType has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function getChangeType(
        Content $oldContent = null,
        Content $newContent = null,
        $flags = 0
    ) {
Severity: Minor
Found in includes/content/ContentHandler.php - About 1 hr 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 load has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function load() {
        if ( $this->procCache !== null ) {
            return; // already loaded
        }

Severity: Minor
Found in includes/config/EtcdConfig.php - About 1 hr 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 splitTagStack has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function splitTagStack( SerializerNode $parentNode, $inline, $pos ) {
        $parentData = $parentNode->snData;
        $wrapBase = $parentData->wrapBaseNode;
        $pWrap = $parentData->ancestorPNode;
        if ( !$pWrap ) {
Severity: Minor
Found in includes/tidy/RemexCompatMunger.php - About 1 hr 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 dump has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function dump( $history, $text = WikiExporter::TEXT ) {
        # Notice messages will foul up your XML output even if they're
        # relatively harmless.
        if ( ini_get( 'display_errors' ) ) {
            ini_set( 'display_errors', 'stderr' );
Severity: Minor
Found in maintenance/includes/BackupDumper.php - About 1 hr 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 checkSqlSyntax has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public static function checkSqlSyntax( $files ) {
        if ( !self::isPresent() ) {
            throw new RuntimeException( "Can't check SQL syntax: SQLite not found" );
        }
        if ( !is_array( $files ) ) {
Severity: Minor
Found in maintenance/Sqlite.php - About 1 hr 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