wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Function save has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private function save() {
        # Permission check!
        if ( $this->disabled ) {
            $this->show();
            return false;
Severity: Minor
Found in includes/page/ProtectionForm.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 getProperties has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function getProperties( $titles, $propertyNames ) {
        if ( is_array( $propertyNames ) ) {
            $gotArray = true;
        } else {
            $propertyNames = [ $propertyNames ];
Severity: Minor
Found in includes/page/PageProps.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 loadAsComponents has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function loadAsComponents( bool $inlineReferences = false ): array {
        $schemas = [];
        $defs = [];
        $obsolete = [];

Severity: Minor
Found in includes/Settings/Source/ReflectionSchemaSource.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 getParserOutput has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function getParserOutput(
        PageRecord $page,
        ParserOptions $parserOptions,
        ?RevisionRecord $revision = null,
        int $options = 0
Severity: Minor
Found in includes/page/ParserOutputAccess.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 getLessCompiler has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function getLessCompiler( array $vars = [], array $importDirs = [] ) {
        // When called from the installer, it is possible that a required PHP extension
        // is missing (at least for now; see T49564). If this is the case, throw an
        // exception (caught by the installer) to prevent a fatal error later on.
        if ( !class_exists( Less_Parser::class ) ) {
Severity: Minor
Found in includes/ResourceLoader/ResourceLoader.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 getAuthenticationRequestsInternal has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private function getAuthenticationRequestsInternal(
        $providerAction, array $options, array $providers, UserIdentity $user = null
    ) {
        $user = $user ?: RequestContext::getMain()->getUser();
        $options['username'] = $user->isRegistered() ? $user->getName() : null;
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 importFormData has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function importFormData( &$request ) {
        # Section edit can come from either the form or a link
        $this->section = $request->getVal( 'wpSection', $request->getVal( 'section', '' ) );

        if ( $this->section !== null && $this->section !== '' && !$this->isSectionEditSupported() ) {
Severity: Minor
Found in includes/editpage/EditPage.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 prefetch has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function prefetch( $page, $rev, $slot = SlotRecord::MAIN ) {
        $page = intval( $page );
        $rev = intval( $rev );
        while ( $this->lastPage < $page && !$this->atEnd ) {
            $this->debug( "BaseDump::prefetch at page $this->lastPage, looking for $page" );
Severity: Minor
Found in includes/export/BaseDump.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 tryReset has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    protected function tryReset( User $user, array $reqs ) {
        $data = $this->manager->getAuthenticationSessionData( 'reset-pass' );
        if ( !$data ) {
            return AuthenticationResponse::newAbstain();
        }
Severity: Minor
Found in includes/auth/ResetPasswordSecondaryAuthenticationProvider.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 sendEmailUnsafe has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function sendEmailUnsafe(
        UserEmailContact $target,
        string $subject,
        string $text,
        bool $CCMe,
Severity: Minor
Found in includes/mail/EmailUser.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 handleUpload has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private function handleUpload( &$pageInfo ) {
        $this->debug( "Enter upload handler" );
        $uploadInfo = [];

        $normalFields = [ 'timestamp', 'comment', 'filename', 'text',
Severity: Minor
Found in includes/import/WikiImporter.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 convertGrammar has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function convertGrammar( $word, $case ) {
        $grammarForms =
            MediaWikiServices::getInstance()->getMainConfig()->get( MainConfigNames::GrammarForms );
        if ( isset( $grammarForms['os'][$case][$word] ) ) {
            return $grammarForms['os'][$case][$word];
Severity: Minor
Found in includes/languages/LanguageOs.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 doModify has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private function doModify( CommentStoreComment $summary ): PageUpdateStatus {
        $wikiPage = $this->getWikiPage(); // TODO: use for legacy hooks only!

        // Update article, but only if changed.
        $status = PageUpdateStatus::newEmpty( false );
Severity: Minor
Found in includes/Storage/PageUpdater.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 stripComments has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public static function stripComments( $json ) {
        // Ensure we have a string
        $str = (string)$json;
        $buffer = '';
        $maxLen = strlen( $str );
Severity: Minor
Found in includes/json/FormatJson.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 normalizeRequests has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private function normalizeRequests( array &$reqs ) {
        foreach ( $reqs as &$req ) {
            $req['response'] = [
                'code'     => 0,
                'reason'   => '',
Severity: Minor
Found in includes/libs/http/MultiHttpClient.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 runMultiCurl has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    private function runMultiCurl( array $reqs, array $opts ) {
        $chm = $this->getCurlMulti( $opts );

        $selectTimeout = $this->getSelectTimeout( $opts );

Severity: Minor
Found in includes/libs/http/MultiHttpClient.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 toSql has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function toSql( DbQuoter $dbQuoter ): string {
        if ( is_array( $this->value ) ) {
            if ( count( $this->value ) === 1 ) {
                $value = $this->value[0];
                if ( $this->op === '=' ) {
Severity: Minor
Found in includes/libs/rdbms/expression/Expression.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 extractResultInfo has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    protected function extractResultInfo( $isFirst, $limit, IResultWrapper $res ) {
        $numRows = $res->numRows();

        $firstIndex = [];
        $lastIndex = [];
Severity: Minor
Found in includes/pager/IndexPager.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 getSiteNotice has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function getSiteNotice() {
        $siteNotice = '';

        if ( $this->getHookRunner()->onSiteNoticeBefore( $siteNotice, $this ) ) {
            if ( $this->getUser()->isRegistered() ) {
Severity: Minor
Found in includes/skins/Skin.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 areFiltersInConflict has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    protected function areFiltersInConflict() {
        $opts = $this->getOptions();
        foreach ( $this->getFilterGroups() as $group ) {
            if ( $group->getConflictingGroups() ) {
                wfLogWarning(
Severity: Minor
Found in includes/specialpage/ChangesListSpecialPage.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