wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Function loadCoreData has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    private function loadCoreData( string $code ) {
        if ( !$code ) {
            throw new InvalidArgumentException( "Invalid language code requested" );
        }
        if ( $this->coreDataLoaded[$code] ?? false ) {
Severity: Minor
Found in includes/language/LocalisationCache.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 convertDumpToJSON has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    private function convertDumpToJSON( $dump ) {
        if ( strval( $dump ) == '' ) {
            return false;
        }

Severity: Minor
Found in includes/media/DjVuImage.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 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $this->useTransactionalTimeLimit();

        $user = $this->getUser();
        $params = $this->extractRequestParams();
Severity: Minor
Found in includes/api/ApiMove.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 getChunkResult has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    private function getChunkResult( $warnings ) {
        $result = [];

        if ( $warnings && count( $warnings ) > 0 ) {
            $result['warnings'] = $warnings;
Severity: Minor
Found in includes/api/ApiUpload.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 run has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    private function run( $resultPageSet = null ) {
        $db = $this->getDB();
        $params = $this->extractRequestParams();

        $this->addTables( 'category' );
Severity: Minor
Found in includes/api/ApiQueryAllCategories.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 runQuery has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    protected function runQuery( $resultPageSet, $limit, $start, $startId, $end ) {
        $params = $this->extractRequestParams();

        $this->resetQueryParams();
        $this->addTables( 'page' );
Severity: Minor
Found in includes/api/ApiQueryRandom.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 getThumbnailSource has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function getThumbnailSource( $params ) {
        if ( $this->repo
            && $this->getHandler()->supportsBucketing()
            && isset( $params['physicalWidth'] )
        ) {
Severity: Minor
Found in includes/filerepo/file/File.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 maybeUpgradeRow has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function maybeUpgradeRow() {
        if ( MediaWikiServices::getInstance()->getReadOnlyMode()->isReadOnly() || $this->upgrading ) {
            return;
        }

Severity: Minor
Found in includes/filerepo/file/LocalFile.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 debugMsg has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public static function debugMsg( $str, $context = [] ) {
        global $wgDebugComments, $wgShowDebug;

        if ( self::$enabled || $wgDebugComments || $wgShowDebug ) {
            if ( $context ) {
Severity: Minor
Found in includes/debug/MWDebug.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 getLine has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function getLine( array $feed, RecentChange $rc, $actionComment ) {
        $mainConfig = MediaWikiServices::getInstance()->getMainConfig();
        $canonicalServer = $mainConfig->get( MainConfigNames::CanonicalServer );
        $serverName = $mainConfig->get( MainConfigNames::ServerName );
        $scriptPath = $mainConfig->get( MainConfigNames::ScriptPath );
Severity: Minor
Found in includes/recentchanges/RCFeed/MachineReadableRCFeedFormatter.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 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        global $IP;

        $platform = $this->getOption( 'type', 'mysql' );
        $jsonPath = $this->getOption( 'json', dirname( __DIR__ ) );
Severity: Minor
Found in maintenance/includes/SchemaMaintenance.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 finalSetup has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function finalSetup( SettingsBuilder $settingsBuilder ) {
        $config = $settingsBuilder->getConfig();
        $overrides = [];
        $overrides['DBadminuser'] = $config->get( MainConfigNames::DBadminuser );
        $overrides['DBadminpassword'] = $config->get( MainConfigNames::DBadminpassword );
Severity: Minor
Found in maintenance/includes/Maintenance.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 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $services = $this->getServiceContainer();
        $lbFactory = $services->getDBLoadBalancerFactory();
        $stats = $services->getStatsFactory();
        $lbsByType = [
Severity: Minor
Found in maintenance/getLagTimes.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 copyFileBatch has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    protected function copyFileBatch(
        array $srcPathsRel, $backendRel, FileBackend $src, FileBackend $dst
    ) {
        $ops = [];
        $fsFiles = [];
Severity: Minor
Found in maintenance/copyFileBackend.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 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        if ( !$this->hasOption( 'delete' ) ) {
            $this->output( "Use --delete to actually confirm this script\n" );
            return;
        }
Severity: Minor
Found in maintenance/deleteArchivedFiles.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 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        global $wgHTCPRouting;

        if ( $this->hasOption( 'htcp-dest' ) ) {
            $parts = explode( ':', $this->getOption( 'htcp-dest' ), 2 );
Severity: Minor
Found in maintenance/purgeChangedPages.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 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $async = $this->hasOption( 'async' );
        $dryrun = $this->hasOption( 'dry-run' );

        if ( $this->hasOption( 'title' ) ) {
Severity: Minor
Found in maintenance/fixDoubleRedirects.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 checkAll has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    private function checkAll( $options ) {
        $contLang = $this->getServiceContainer()->getContentLanguage();
        $spaces = [];

        // List interwikis first, so they'll be overridden
Severity: Minor
Found in maintenance/namespaceDupes.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 24 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $typeFilter = $this->getOption( 'type', '' );
        $stateFilter = $this->getOption( 'status', '' );
        $stateLimit = (float)$this->getOption( 'limit', INF );

Severity: Minor
Found in maintenance/showJobs.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

File MessagesKk_latn.php has 309 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/** Kazakh (Latin script) (qazaqşa (latın))
 *
 * @file
 * @ingroup Languages
Severity: Minor
Found in languages/messages/MessagesKk_latn.php - About 3 hrs to fix
    Severity
    Category
    Status
    Source
    Language