wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

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

    protected function doConcatenate( array $params ) {
        $status = $this->newStatus();
        $tmpPath = $params['dst'];
        unset( $params['latest'] );

Severity: Minor
Found in includes/libs/filebackend/FileBackendStore.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 doStoreInternal has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function doStoreInternal( array $params ) {
        $status = $this->newStatus();

        $fsSrcPath = $params['src']; // file system path
        $fsDstPath = $this->resolveToFSPath( $params['dst'] );
Severity: Minor
Found in includes/libs/filebackend/FSFileBackend.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 startAtomic has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    final public function startAtomic(
        $fname = __METHOD__,
        $cancelable = self::ATOMIC_NOT_CANCELABLE
    ) {
        $cs = $this->commenceCriticalSection( __METHOD__ );
Severity: Minor
Found in includes/libs/rdbms/database/Database.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 validate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function validate( $reader ) {
        // First, move through anything that isn't an element, and
        // handle any processing instructions with the callback
        do {
            if ( !$this->readNext( $reader ) ) {
Severity: Minor
Found in includes/libs/mime/XmlTypeCheck.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 factorCondsWithCommonFields has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function factorCondsWithCommonFields( $condsArray ) {
        $first = $condsArray[array_key_first( $condsArray )];
        if ( count( $first ) === 1 ) {
            // IN clause
            $field = array_key_first( $first );
Severity: Minor
Found in includes/libs/rdbms/platform/SQLPlatform.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 approvePrimaryChanges has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function approvePrimaryChanges( int $maxWriteDuration, $fname = __METHOD__ ) {
        $this->assertTransactionRoundStage( self::ROUND_FINALIZED );
        /** @noinspection PhpUnusedLocalVariableInspection */
        $scope = ScopedCallback::newScopedIgnoreUserAbort();

Severity: Minor
Found in includes/libs/rdbms/loadbalancer/LoadBalancer.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 pickReaderIndex has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function pickReaderIndex( array $loads ) {
        if ( $loads === [] ) {
            throw new InvalidArgumentException( "Server configuration array is empty" );
        }

Severity: Minor
Found in includes/libs/rdbms/loadbalancer/LoadBalancer.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 buildContentActionUrls has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function buildContentActionUrls( $content_navigation ) {
        // content_actions has been replaced with content_navigation for backwards
        // compatibility and also for skins that just want simple tabs content_actions
        // is now built by flattening the content_navigation arrays into one

Severity: Minor
Found in includes/skins/SkinTemplate.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 loadFromRow has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function loadFromRow( $row ) {
        if ( $row ) { // page found
            if ( isset( $row->page_id ) ) {
                $this->mArticleID = (int)$row->page_id;
            }
Severity: Minor
Found in includes/title/Title.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 getNewRevision has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function getNewRevision() {
        $undoRev = $this->revisionLookup->getRevisionById( $this->undo );
        $oldRev = $this->revisionLookup->getRevisionById( $this->undoafter );
        $curRev = $this->curRev;

Severity: Minor
Found in includes/actions/McrUndoAction.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 getUndeleteLink has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function getUndeleteLink() {
        $action = $this->getRequest()->getRawVal( 'action', 'view' );
        $title = $this->getTitle();
        $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();

Severity: Minor
Found in includes/skins/Skin.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 getPersonalToolsForMakeListItem has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    final public function getPersonalToolsForMakeListItem( $urls, $applyClassesToListItems = false ) {
        $personal_tools = [];
        foreach ( $urls as $key => $plink ) {
            # The class on a personal_urls item is meant to go on the <a> instead
            # of the <li> so we have to use a single item "links" array instead
Severity: Minor
Found in includes/skins/Skin.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 readCentralDirectory has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function readCentralDirectory( $offset, $size ) {
        $block = $this->getBlock( $offset, $size );

        $fixedInfo = [
            'signature' => [ 'string', 4 ],
Severity: Minor
Found in includes/utils/ZipDirectoryReader.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 __construct has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct( $repoDir, $usePrecomputed = true ) {
        $this->repoDir = $repoDir;
        $services = MediaWikiServices::getInstance();
        $this->options = new ServiceOptions(
            self::CONSTRUCTOR_OPTIONS, $services->getMainConfig()
Severity: Minor
Found in includes/utils/GitInfo.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 getFinalUrl has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function getFinalUrl() {
        $headers = $this->getResponseHeaders();

        // return full url (fix for incorrect but handled relative location)
        if ( isset( $headers['location'] ) ) {
Severity: Minor
Found in includes/http/MWHttpRequest.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 assemble has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public static function assemble( array $urlParts ): string {
        $result = '';

        if ( isset( $urlParts['delimiter'] ) ) {
            if ( isset( $urlParts['scheme'] ) ) {
Severity: Minor
Found in includes/utils/UrlUtils.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 convertGrammar has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function convertGrammar( $word, $case ) {
        $grammarForms = $this->config->get( MainConfigNames::GrammarForms );
        if ( isset( $grammarForms[$this->getCode()][$case][$word] ) ) {
            return $grammarForms[$this->getCode()][$case][$word];
        }
Severity: Minor
Found in includes/language/Language.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 recursiveConvertRule has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function recursiveConvertRule( $text, $variant, &$startPos, $depth = 0 ) {
        // Quick check (no function calls)
        if ( $text[$startPos] !== '-' || $text[$startPos + 1] !== '{' ) {
            throw new InvalidArgumentException( __METHOD__ . ': invalid input string' );
        }
Severity: Minor
Found in includes/language/LanguageConverter.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 localizeElement has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function localizeElement( Element $node, Bcp47Code $lang, Document $doc ) {
        if ( DOMUtils::hasTypeOf( $node, 'mw:LocalizedAttrs' ) ) {
            $i18nNames = DOMDataUtils::getDataAttrI18nNames( $node );
            if ( count( $i18nNames ) === 0 ) {
                $this->logger->warning( 'node with mw:LocalizedAttrs typeof does not contain localisation data',
Severity: Minor
Found in includes/OutputTransform/Stages/ParsoidLocalization.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 validate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function validate( $section, $tag, $val, $recursive = false ): bool {
        $debug = "tag is '$tag'";
        $etype = $this->mExifTags[$section][$tag];
        $ecount = 1;
        if ( is_array( $etype ) ) {
Severity: Minor
Found in includes/media/Exif.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