wikimedia/mediawiki-core

View on GitHub

Showing 9,710 of 11,773 total issues

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

    public function execute() {
        $this->output( "Fetching redirects...\n" );
        $dbr = $this->getReplicaDB();
        $result = $dbr->newSelectQueryBuilder()
            ->select( [ 'page_namespace', 'page_title', 'page_latest' ] )
Severity: Minor
Found in maintenance/checkBadRedirects.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 doDBUpdates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function doDBUpdates() {
        $dbw = $this->getDB( DB_PRIMARY );
        $mapping = \MediaWiki\Linker\LinksMigration::$mapping;
        $table = $this->getOption( 'table', '' );
        if ( !isset( $mapping[$table] ) ) {
Severity: Minor
Found in maintenance/migrateLinksTable.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 scanRevisionsById has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function scanRevisionsById( array $ids ) {
        $count = 0;
        $total = count( $ids );

        $this->output( "Scanning $total ids\n" );
Severity: Minor
Found in maintenance/findBadBlobs.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() {
        $languageNameUtils = $this->getServiceContainer()->getLanguageNameUtils();
        foreach ( $this->mLangs as $code ) {
            $filename = $languageNameUtils->getMessagesFileName( $code );
            $this->output( "Loading language [$code] ..." );
Severity: Minor
Found in maintenance/language/digit2html.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() {
        $this->init();

        $this->outDir = $this->getOption( 'outdir', MW_INSTALL_PATH . '/languages/i18n' );
        if ( !file_exists( $this->outDir ) ) {
Severity: Minor
Found in maintenance/language/importExtensionMessages.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 setPassOption has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function setPassOption() {
        $passfile = $this->getOption( 'passfile' );
        if ( $passfile !== null ) {
            if ( $this->getOption( 'pass' ) !== null ) {
                $this->error( 'WARNING: You have provided the option --pass or --passfile. '
Severity: Minor
Found in maintenance/install.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 handlePageBatch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function handlePageBatch( $lowPageId, $mapping, $table ) {
        $batchSize = $this->getBatchSize();
        $targetColumn = $mapping[$table]['target_id'];
        $pageIdColumn = $mapping[$table]['page_id'];
        // BETWEEN is inclusive, let's subtract one.
Severity: Minor
Found in maintenance/migrateLinksTable.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 copyBatch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function copyBatch( IResultWrapper $res ) {
        $sortKeyInputs = [];
        foreach ( $res as $row ) {
            $title = Title::newFromRow( $row );
            $sortKeyInputs[] = $title->getCategorySortkey( $row->cl_sortkey_prefix );
Severity: Minor
Found in maintenance/updateCollation.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 doPopulate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function doPopulate( array $data, $force ) {
        $dbw = $this->getPrimaryDB();

        if ( !$force ) {
            $row = $dbw->newSelectQueryBuilder()
Severity: Minor
Found in maintenance/populateInterwiki.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 translate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def translate(text, conv_table):
    i = 0
    while i < len(text):
        for j in range(len(text) - i, 0, -1):
            f = text[i:][:j]
Severity: Minor
Found in maintenance/language/zhtable/Makefile.py - 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