wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Function view has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function view() {
        $context = $this->getContext();
        $useFileCache = $context->getConfig()->get( MainConfigNames::UseFileCache );

        # Get variables from query string
Severity: Minor
Found in includes/page/Article.php - About 2 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 preloadTitleInfo has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public static function preloadTitleInfo(
        Context $context, array $moduleNames
    ) {
        $rl = $context->getResourceLoader();
        // getDB() can be overridden to point to a foreign database.
Severity: Minor
Found in includes/ResourceLoader/WikiModule.php - About 2 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 securitySensitiveOperationStatus has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function securitySensitiveOperationStatus( $operation ) {
        $status = self::SEC_OK;

        $this->logger->debug( __METHOD__ . ": Checking $operation" );

Severity: Minor
Found in includes/auth/AuthManager.php - About 2 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 providerAllowsAuthenticationDataChange has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function providerAllowsAuthenticationDataChange(
        AuthenticationRequest $req, $checkData = true
    ) {
        // We only want to blank the password if something else will accept the
        // new authentication data, so return 'ignore' here.
Severity: Minor
Found in includes/auth/LocalPasswordPrimaryAuthenticationProvider.php - About 2 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 send has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public static function send( $to, $from, $subject, $body, $options = [] ) {
        $services = MediaWikiServices::getInstance();
        $allowHTMLEmail = $services->getMainConfig()->get(
            MainConfigNames::AllowHTMLEmail );

Severity: Minor
Found in includes/mail/UserMailer.php - About 2 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 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute( $skipcache = false ) {
        if ( !$this->cacheable || $skipcache ) {
            $status = $this->poolCounter->acquireForMe();
        } else {
            if ( $this->isFastStaleEnabled() ) {
Severity: Minor
Found in includes/poolcounter/PoolCounterWork.php - About 2 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 doCopyInternal has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

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

        $fsSrcPath = $this->resolveToFSPath( $params['src'] );
        if ( $fsSrcPath === null ) {
Severity: Minor
Found in includes/libs/filebackend/FSFileBackend.php - About 2 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 getInputHTMLForKey has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getInputHTMLForKey( $key, array $values ) {
        $displayFormat = $this->mParams['format'] ?? $this->mParent->getDisplayFormat();

        // Conveniently, PHP method names are case-insensitive.
        $getFieldHtmlMethod = $displayFormat == 'table' ? 'getTableRow' : ( 'get' . $displayFormat );
Severity: Minor
Found in includes/htmlform/fields/HTMLFormFieldCloner.php - About 2 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 getButtons has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function getButtons() {
        $buttons = '';

        if ( $this->mShowSubmit ) {
            $attribs = [
Severity: Minor
Found in includes/htmlform/OOUIHTMLForm.php - About 2 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 getErrorsOrWarnings has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function getErrorsOrWarnings( $elements, $elementsType ) {
        if ( $elements === '' ) {
            return '';
        }

Severity: Minor
Found in includes/htmlform/OOUIHTMLForm.php - About 2 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 listDropdownOptions has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public static function listDropdownOptions( $list, $params = [] ) {
        $options = [];

        if ( isset( $params['other'] ) ) {
            $options[ $params['other'] ] = 'other';
Severity: Minor
Found in includes/Html/Html.php - About 2 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 getButtons has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function getButtons() {
        $buttons = '';

        if ( $this->mShowSubmit ) {
            $attribs = [];
Severity: Minor
Found in includes/htmlform/HTMLForm.php - About 2 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 skinPreferences has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    protected function skinPreferences( User $user, IContextSource $context, &$defaultPreferences ) {
        // Skin selector, if there is at least one valid skin
        $validSkinNames = $this->getValidSkinNames( $user, $context );
        if ( $validSkinNames ) {
            $defaultPreferences['skin'] = [
Severity: Minor
Found in includes/preferences/DefaultPreferencesFactory.php - About 2 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 getMsgFromNamespace has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function getMsgFromNamespace( $title, $code ) {
        // Load all MediaWiki page definitions into cache. Note that individual keys
        // already loaded into the cache during this request remain in the cache, which
        // includes the value of hook-defined messages.
        $this->load( $code );
Severity: Minor
Found in includes/language/MessageCache.php - About 2 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 listDropdownOptions has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public static function listDropdownOptions( $list, $params = [] ) {
        $options = [];

        if ( isset( $params['other'] ) ) {
            $options[ $params['other'] ] = 'other';
Severity: Minor
Found in includes/xml/Xml.php - About 2 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 mteiToBengali has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    private function mteiToBengali( $text ) {
        $chars = mb_str_split( $text );
        $l = count( $chars );
        $i = 0;
        while ( $i < $l ) {
Severity: Minor
Found in includes/language/converters/MniConverter.php - About 2 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 normaliseParams has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function normaliseParams( $image, &$params ) {
        if ( !isset( $params['width'] ) ) {
            return false;
        }

Severity: Minor
Found in includes/media/ImageHandler.php - About 2 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 wfCgiToArray has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

function wfCgiToArray( $query ) {
    if ( isset( $query[0] ) && $query[0] == '?' ) {
        $query = substr( $query, 1 );
    }
    $bits = explode( '&', $query );
Severity: Minor
Found in includes/GlobalFunctions.php - About 2 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 getUserLinks has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getUserLinks(
        SpecialPage $sp,
        User $target
    ) {
        $id = $target->getId();
Severity: Minor
Found in includes/specialpage/ContributionsSpecialPage.php - About 2 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 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        global $wgLang;
        $r = $this->parent->request;
        $userLang = $r->getVal( 'uselang' );
        $contLang = $r->getVal( 'ContLang' );
Severity: Minor
Found in includes/installer/WebInstallerLanguage.php - About 2 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