wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Function doQuery has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function doQuery( array $userIds, $options = [], $caller = '' ) {
        $usersToCheck = [];
        $usersToQuery = [];

        $userIds = array_unique( $userIds );
Severity: Minor
Found in includes/cache/UserCache.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 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        // If there is no LocalSettings.php, continue to the installer welcome page
        $vars = Installer::getExistingLocalSettings();
        if ( !$vars ) {
            return 'skip';
Severity: Minor
Found in includes/installer/WebInstallerExistingWiki.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 getParsedContent has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    private function getParsedContent(
        WikiPage $page, $popts, $suppressCache, $pageId, $rev, $getContent
    ) {
        $revId = $rev ? $rev->getId() : null;
        $isDeleted = $rev && $rev->isDeleted( RevisionRecord::DELETED_TEXT );
Severity: Minor
Found in includes/api/ApiParse.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 getParamInfo has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function getParamInfo( $name, array $settings, array $options ) {
        $info = parent::getParamInfo( $name, $settings, $options );
        /** @var ApiBase $module */
        $module = $options['module'];

Severity: Minor
Found in includes/api/Validator/SubmoduleDef.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 createFeedItem has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    private function createFeedItem( $info ) {
        if ( !isset( $info['title'] ) ) {
            // Probably a revdeled log entry, skip it.
            return null;
        }
Severity: Minor
Found in includes/api/ApiFeedWatchlist.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 initFromRevIDs has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    private function initFromRevIDs( $revids ) {
        if ( !$revids ) {
            return;
        }

Severity: Minor
Found in includes/api/ApiPageSet.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 modifyHelp has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function modifyHelp( array &$help, array $options, array &$tocData ) {
        // Wish PHP had an "array_insert_before". Instead, we have to manually
        // reindex the array to get 'permissions' in the right place.
        $oldHelp = $help;
        $help = [];
Severity: Minor
Found in includes/api/ApiMain.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

Method __construct has 18 arguments (exceeds 4 allowed). Consider refactoring.
Open

        ApiQuery $query,
        $moduleName,
        UserOptionsLookup $userOptionsLookup,
        UserGroupManager $userGroupManager,
        LanguageConverterFactory $languageConverterFactory,
Severity: Major
Found in includes/api/ApiQuerySiteinfo.php - About 2 hrs to fix

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

        public function execute() {
            $params = $this->extractRequestParams();
    
            $config = $this->getConfig();
            if ( !$config->get( MainConfigNames::Feed ) ) {
    Severity: Minor
    Found in includes/api/ApiFeedContributions.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 modifyTableSpecificBlobsForChangeTTL has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        private function modifyTableSpecificBlobsForChangeTTL(
            IDatabase $db,
            string $ptable,
            float $mtime,
            array $argsByKey,
    Severity: Minor
    Found in includes/objectcache/SqlBagOStuff.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 extractData has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        private function extractData( array $data, bool $rawData = false ): array {
            $result = [];
            if ( $data && !empty( $data['results'] ) ) {
                $vars = $data['head']['vars'];
                $resrow = [];
    Severity: Minor
    Found in includes/sparql/SparqlClient.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 outputChangesList has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function outputChangesList( $rows, $opts ) {
            $dbr = $this->getDB();
            $user = $this->getUser();
            $output = $this->getOutput();
    
    
    Severity: Minor
    Found in includes/specials/SpecialWatchlist.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 deleteServerObjectsExpiringBefore has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        private function deleteServerObjectsExpiringBefore(
            IDatabase $db,
            $timestamp,
            $limit,
            &$keysDeletedCount = 0,
    Severity: Minor
    Found in includes/objectcache/SqlBagOStuff.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 processVerificationError has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function processVerificationError( $details ) {
            switch ( $details['status'] ) {
                /** Statuses that only require name changing */
                case UploadBase::MIN_LENGTH_PARTNAME:
                    $this->showRecoverableUploadError( $this->msg( 'minlength1' )->escaped() );
    Severity: Minor
    Found in includes/specials/SpecialUpload.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 getRestrictionListHTML has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        private function getRestrictionListHTML( stdClass $row ) {
            $items = [];
            $linkRenderer = $this->getLinkRenderer();
    
            foreach ( $this->restrictions as $restriction ) {
    Severity: Minor
    Found in includes/specials/pagers/BlockListPager.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 preprocessResults has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function preprocessResults( $result ) {
            // Do a link batch query
            $lb = $this->linkBatchFactory->newLinkBatch();
            $lb->setCaller( __METHOD__ );
    
    
    Severity: Minor
    Found in includes/specials/pagers/BlockListPager.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 create has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function create(
            PageIdentity $pageId,
            ?UserIdentity $user = null,
            $revision = null,
            ?string $unused = null, /* Added to mollify CI with cross-repo uses */
    Severity: Minor
    Found in includes/parser/Parsoid/Config/PageConfigFactory.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 magicLinkCallback has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        private function magicLinkCallback( array $m ) {
            if ( isset( $m[1] ) && $m[1] !== '' ) {
                # Skip anchor
                return $m[0];
            } elseif ( isset( $m[2] ) && $m[2] !== '' ) {
    Severity: Minor
    Found in includes/parser/Parser.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 addUserToGroup has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function addUserToGroup(
            UserIdentity $user,
            string $group,
            string $expiry = null,
            bool $allowUpdate = false
    Severity: Minor
    Found in includes/user/UserGroupManager.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 isAllowedHost has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function isAllowedHost( $url ) {
            $domains = self::getAllowedHosts();
            if ( !count( $domains ) ) {
                return true;
            }
    Severity: Minor
    Found in includes/upload/UploadFromUrl.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