wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Function MwWidgetsTableWidget has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

mw.widgets.TableWidget = function MwWidgetsTableWidget( config ) {
    // Configuration initialization
    config = config || {};

    // Parent constructor
Severity: Minor
Found in resources/src/mediawiki.widgets/Table/mw.widgets.TableWidget.js - About 1 hr 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 autoUpdate has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

function autoUpdate(reference, floating, update, options) {
  if (options === void 0) {
    options = {};
  }
  const {
Severity: Minor
Found in resources/lib/codex/codex.js - About 1 hr 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 setNotificationTimestampsForUser has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function setNotificationTimestampsForUser(
        UserIdentity $user,
        $timestamp,
        array $targets = []
    ): bool {
Severity: Minor
Found in includes/watchlist/WatchedItemStore.php - About 1 hr 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 getPermissionStatus has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function getPermissionStatus(
        $action,
        User $user,
        LinkTarget $page,
        $rigor = self::RIGOR_SECURE,
Severity: Minor
Found in includes/Permissions/PermissionManager.php - About 1 hr 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 uncacheAllItemsForUser has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private function uncacheAllItemsForUser( UserIdentity $user ) {
        $userId = $user->getId();
        foreach ( $this->cacheIndex as $ns => $dbKeyIndex ) {
            foreach ( $dbKeyIndex as $dbKey => $userIndex ) {
                if ( array_key_exists( $userId, $userIndex ) ) {
Severity: Minor
Found in includes/watchlist/WatchedItemStore.php - About 1 hr 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 getUserPermissions has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function getUserPermissions( UserIdentity $user ): array {
        $rightsCacheKey = $this->getRightsCacheKey( $user );
        if ( !isset( $this->usersRights[ $rightsCacheKey ] ) ) {
            $userObj = $this->userFactory->newFromUserIdentity( $user );
            $rights = $this->groupPermissionsLookup->getGroupPermissions(
Severity: Minor
Found in includes/Permissions/PermissionManager.php - About 1 hr 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 internalAllowed has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private function internalAllowed(
        string $action,
        ?PermissionStatus $status,
        $limitRate,
        ?Block $userBlock
Severity: Minor
Found in includes/Permissions/UserAuthority.php - About 1 hr 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 getRobotPolicy has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function getRobotPolicy( $action, ParserOutput $pOutput = null ) {
        $context = $this->getContext();
        $mainConfig = $context->getConfig();
        $articleRobotPolicies = $mainConfig->get( MainConfigNames::ArticleRobotPolicies );
        $namespaceRobotPolicies = $mainConfig->get( MainConfigNames::NamespaceRobotPolicies );
Severity: Minor
Found in includes/page/Article.php - About 1 hr 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 applySettings has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private function applySettings( array $settings ) {
        // First extract config variables that change the behavior of SettingsBuilder.
        // No merge strategies are applied, defaults are set in the constructor.
        if ( isset( $settings['config'] ) ) {
            $this->updateSettingsConfig( $settings['config'] );
Severity: Minor
Found in includes/Settings/SettingsBuilder.php - About 1 hr 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 renderRevision has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private function renderRevision(
        PageRecord $page,
        ParserOptions $parserOptions,
        RevisionRecord $revision,
        int $options,
Severity: Minor
Found in includes/page/ParserOutputAccess.php - About 1 hr 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 __construct has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct( $options = [] ) {
        $services = MediaWikiServices::getInstance();
        if ( isset( $options['config'] ) ) {
            $this->config = $options['config'];
            if ( !$this->config instanceof Config ) {
Severity: Minor
Found in includes/session/SessionManager.php - About 1 hr 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 applyFeaturesCompatibility has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function applyFeaturesCompatibility(
        array $features, bool $addUnspecifiedFeatures = true, &$messages = ''
    ): array {
        if ( isset( $features[ 'i18n-all-lists-margins' ] ) ) {
            // Emit warning only. Key is supported as-is.
Severity: Minor
Found in includes/ResourceLoader/SkinModule.php - About 1 hr 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 14 arguments (exceeds 4 allowed). Consider refactoring.
Open

        PageIdentity $source,
        PageIdentity $dest,
        ?string $timestamp,
        IConnectionProvider $dbProvider,
        IContentHandlerFactory $contentHandlerFactory,
Severity: Major
Found in includes/page/MergeHistory.php - About 1 hr to fix

    Function addImplementScript has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        private function addImplementScript( MinifierState $minifier,
            $moduleName, $version, $scripts, $styles, $messages, $templates, $deprecationWarning
        ) {
            $implementKey = "$moduleName@$version";
            // Plain functions are used instead of arrow functions to avoid
    Severity: Minor
    Found in includes/ResourceLoader/ResourceLoader.php - About 1 hr 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 beginPrimaryAuthentication has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function beginPrimaryAuthentication( array $reqs ) {
            $req = AuthenticationRequest::getRequestByClass( $reqs, PasswordAuthenticationRequest::class );
            if ( !$req || $req->username === null || $req->password === null ) {
                return AuthenticationResponse::newAbstain();
            }
    Severity: Minor
    Found in includes/auth/LocalPasswordPrimaryAuthenticationProvider.php - About 1 hr 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 checkSettings has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function checkSettings( string $name, $settings, array $options, array $ret ): array {
            $ret = parent::checkSettings( $name, $settings, $options, $ret );
    
            $ret['allowedKeys'] = array_merge( $ret['allowedKeys'], [
                self::PARAM_ALLOWED_USER_TYPES, self::PARAM_RETURN_OBJECT,
    Severity: Minor
    Found in includes/ParamValidator/TypeDef/UserDef.php - About 1 hr 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 beginAccountCreation has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function beginAccountCreation( Authority $creator, array $reqs, $returnToUrl ) {
            $session = $this->request->getSession();
            if ( !$this->canCreateAccounts() ) {
                // Caller should have called canCreateAccounts()
                $session->remove( self::ACCOUNT_CREATION_STATE );
    Severity: Minor
    Found in includes/auth/AuthManager.php - About 1 hr 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 canSendUserTalkEmail has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        private function canSendUserTalkEmail( UserIdentity $editor, $title, $minorEdit ) {
            $services = MediaWikiServices::getInstance();
            $config = $services->getMainConfig();
    
            if ( !$config->get( MainConfigNames::EnotifUserTalk ) || $title->getNamespace() !== NS_USER_TALK ) {
    Severity: Minor
    Found in includes/mail/EmailNotification.php - About 1 hr 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 getPreloadedContentFromParams has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        private function getPreloadedContentFromParams(
            ProperPageIdentity $contextPage,
            Authority $performer,
            ?string $preload,
            array $preloadParams
    Severity: Minor
    Found in includes/editpage/PreloadedContentBuilder.php - About 1 hr 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 notifyOnPageChange has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function notifyOnPageChange(
            Authority $editor,
            $title,
            $timestamp,
            $summary,
    Severity: Minor
    Found in includes/mail/EmailNotification.php - About 1 hr 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