wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Function diffInternal has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    protected function diffInternal( array $from, array $to ) {
        // remember initial lengths
        $m = count( $from );
        $n = count( $to );

Severity: Minor
Found in includes/libs/Diff/DiffEngine.php - About 3 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 newRevisionsFromBatch has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    public function newRevisionsFromBatch(
        $rows,
        array $options = [],
        $queryFlags = 0,
        PageIdentity $page = null
Severity: Minor
Found in includes/Revision/RevisionStore.php - About 3 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 runParallelBatches has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function runParallelBatches( array $pPerformOps, StatusValue $status ) {
        $aborted = false; // set to true on unexpected errors
        foreach ( $pPerformOps as $performOpsBatch ) {
            if ( $aborted ) { // check batch op abort flag...
                // We can't continue (even with $ignoreErrors) as $predicates is wrong.
Severity: Minor
Found in includes/libs/filebackend/FileOpBatch.php - About 3 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 commitMainTransaction has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    protected function commitMainTransaction() {
        $context = $this->context;

        $config = $context->getConfig();
        $request = $context->getRequest();
Severity: Minor
Found in includes/MediaWikiEntryPoint.php - About 3 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 modifyDisplayQuery has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    public function modifyDisplayQuery( &$tables, &$fields, &$conds,
        &$join_conds, &$options, $filter_tag = '', bool $exclude = false
    ) {
        $useTagFilter = $this->options->get( MainConfigNames::UseTagFilter );

Severity: Minor
Found in includes/changetags/ChangeTagsStore.php - About 3 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 validate has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate( $value, $alldata ) {
        // If the value is null, reset it to an empty string which is what is expected by the parent.
        $value ??= '';

        // If the value is empty, there are no additional checks that can be performed.
Severity: Minor
Found in includes/htmlform/fields/HTMLUserTextField.php - About 3 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 modifyDisplayQueryBuilder has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    public function modifyDisplayQueryBuilder(
        SelectQueryBuilder $queryBuilder,
        $table,
        $filter_tag = '',
        bool $exclude = false
Severity: Minor
Found in includes/changetags/ChangeTagsStore.php - About 3 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 tryEndExpect has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    protected function tryEndExpect( $token ) {
        // @phan-suppress-next-line PhanTypeArraySuspiciousNullable
        switch ( $this->startToken[0] ) {
            case T_DOUBLE_COLON:
                // Skip over T_CLASS after T_DOUBLE_COLON because this is something like
Severity: Minor
Found in includes/utils/ClassCollector.php - About 3 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 collapseContactInfo has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    public function collapseContactInfo( array $vals ) {
        if ( !( isset( $vals['CiAdrExtadr'] )
            || isset( $vals['CiAdrCity'] )
            || isset( $vals['CiAdrCtry'] )
            || isset( $vals['CiEmailWork'] )
Severity: Minor
Found in includes/media/FormatMetadata.php - About 3 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 trySubmit has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    protected function trySubmit() {
        $status = false;

        $form = $this->getAuthForm( $this->authRequests, $this->authAction );
        $form->setSubmitCallback( [ $this, 'handleFormSubmit' ] );
Severity: Minor
Found in includes/specialpage/AuthManagerSpecialPage.php - About 3 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 search has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    private function search( $search, array $params ) {
        $searchEngine = $this->buildSearchEngine( $params );
        $titles = $searchEngine->extractTitles( $searchEngine->completionSearchWithVariants( $search ) );
        $results = [];

Severity: Minor
Found in includes/api/ApiOpenSearch.php - About 3 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 extractSlotInfo has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    private function extractSlotInfo( SlotRecord $slot, $revDel, &$content = null ) {
        $vals = [];
        ApiResult::setArrayType( $vals, 'assoc' );

        if ( $this->fld_slotsize ) {
Severity: Minor
Found in includes/api/ApiQueryRevisionsBase.php - About 3 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 sendCacheHeaders has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    protected function sendCacheHeaders( $isError ) {
        $response = $this->getRequest()->response();
        $out = $this->getOutput();

        $out->addVaryHeader( 'Treat-as-Untrusted' );
Severity: Minor
Found in includes/api/ApiMain.php - About 3 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 appendInterwikiMap has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    protected function appendInterwikiMap( $property, $filter ) {
        $local = $filter ? $filter === 'local' : null;

        $params = $this->extractRequestParams();
        $langCode = $params['inlanguagecode'] ?? '';
Severity: Minor
Found in includes/api/ApiQuerySiteinfo.php - About 3 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 findTitleInternal has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    private function findTitleInternal( $subpage, $forTransclusion ) {
        // base = title without the language code suffix
        // provided = the title as it was given
        $base = $provided = null;
        if ( $subpage !== null ) {
Severity: Minor
Found in includes/specials/SpecialMyLanguage.php - About 3 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 outputChangesList has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    public function outputChangesList( $rows, $opts ) {
        $limit = $opts['limit'];

        $showWatcherCount = $this->getConfig()->get( MainConfigNames::RCShowWatchingUsers )
            && $this->userOptionsLookup->getBoolOption( $this->getUser(), 'shownumberswatching' );
Severity: Minor
Found in includes/specials/SpecialRecentChanges.php - About 3 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 maybeMakeExternalImage has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    private function maybeMakeExternalImage( $url ) {
        $imagesfrom = $this->mOptions->getAllowExternalImagesFrom();
        $imagesexception = (bool)$imagesfrom;
        $text = false;
        # $imagesfrom could be either a single string or an array of strings, parse out the latter
Severity: Minor
Found in includes/parser/Parser.php - About 3 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 getMessageParameters has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getMessageParameters() {
        if ( $this->parsedParametersDeleteLog !== null ) {
            return $this->parsedParametersDeleteLog;
        }

Severity: Minor
Found in includes/logging/DeleteLogFormatter.php - About 3 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 getTitle has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    public function getTitle() {
        if ( $this->mTitle !== false ) {
            return $this->mTitle;
        }
        if ( !is_string( $this->mDesiredDestName ) ) {
Severity: Minor
Found in includes/upload/UploadBase.php - About 3 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 27 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $force = $this->hasOption( 'force' );
        $brokenOnly = $this->hasOption( 'broken-only' );
        $verbose = $this->hasOption( 'verbose' );
        $start = $this->getOption( 'start', false );
Severity: Minor
Found in maintenance/refreshImageMetadata.php - About 3 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