wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

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

    public function execute() {
        $params = $this->extractRequestParams();
        $authority = $this->getAuthority();

        // make sure the user is allowed
Severity: Minor
Found in includes/api/ApiManageTags.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

        ApiQuery $query,
        $moduleName,
        RevisionStore $revisionStore,
        IContentHandlerFactory $contentHandlerFactory,
        ParserFactory $parserFactory,
Severity: Major
Found in includes/api/ApiQueryRevisions.php - About 1 hr to fix

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

        private function modifyBlobs(
            callable $tableWriteCallback,
            float $mtime,
            array $argsByKey,
            &$resByKey = []
    Severity: Minor
    Found in includes/objectcache/SqlBagOStuff.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 setParameter has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function setParameter( $par ) {
            // Extract variables from the request.  Try not to get into a situation where we
            // need to extract *every* variable from the form just for processing here, but
            // there are legitimate uses for some variables
            $request = $this->getRequest();
    Severity: Minor
    Found in includes/specials/SpecialBlock.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 makeLines has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function makeLines() {
            $levels = [];
            $lines = explode( "\n", $this->msg );
    
            foreach ( $lines as $line ) {
    Severity: Minor
    Found in includes/specials/formfields/Licenses.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 getDescriptionSection has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function getDescriptionSection() {
            $config = $this->getConfig();
            if ( $this->mSessionKey ) {
                $stash = $this->localRepo->getUploadStash( $this->getUser() );
                try {
    Severity: Minor
    Found in includes/specials/forms/UploadForm.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 execute has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function execute( $par ) {
            $this->useTransactionalTimeLimit();
    
            $this->setHeaders();
            $this->outputHeader();
    Severity: Minor
    Found in includes/specials/SpecialUpload.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 getExceptionList has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        private function getExceptionList() {
            if ( $this->exceptionList === null ) {
                $this->exceptionList = [];
                $exList = $this->msg( 'uncategorized-categories-exceptionlist' )
                    ->inContentLanguage()->plain();
    Severity: Minor
    Found in includes/specials/SpecialUncategorizedCategories.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

            MovePageFactory $movePageFactory,
            PermissionManager $permManager,
            UserOptionsLookup $userOptionsLookup,
            IConnectionProvider $dbProvider,
            IContentHandlerFactory $contentHandlerFactory,
    Severity: Major
    Found in includes/specials/SpecialMovePage.php - About 1 hr to fix

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

              IContextSource $context,
              CommentStore $commentStore,
              LinkBatchFactory $linkBatchFactory,
              LinkRenderer $linkRenderer,
              IConnectionProvider $dbProvider,
      Severity: Major
      Found in includes/specials/pagers/ProtectedPagesPager.php - About 1 hr to fix

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

            public static function userToolLinkArray(
                $userId, $userText, $redContribsWhenNoEdits = false, $flags = 0, $edits = null
            ): array {
                $services = MediaWikiServices::getInstance();
                $disableAnonTalk = $services->getMainConfig()->get( MainConfigNames::DisableAnonTalk );
        Severity: Minor
        Found in includes/linker/Linker.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 titleAttrib has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function titleAttrib( $name, $options = null, array $msgParams = [], $localizer = null ) {
                if ( !$localizer ) {
                    $localizer = self::getContextFromMain();
                }
                $message = $localizer->msg( "tooltip-$name", $msgParams );
        Severity: Minor
        Found in includes/linker/Linker.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 getImageLinkMTOParams has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function getImageLinkMTOParams( $frameParams, $query = '', $parser = null ) {
                $mtoParams = [];
                if ( isset( $frameParams['link-url'] ) && $frameParams['link-url'] !== '' ) {
                    $mtoParams['custom-url-link'] = $frameParams['link-url'];
                    if ( isset( $frameParams['link-target'] ) ) {
        Severity: Minor
        Found in includes/linker/Linker.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 notifyUpdatesForRevision has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function notifyUpdatesForRevision(
                LBFactory $lbFactory, WikiPage $page, RevisionRecord $newRev
            ) {
                $title = $page->getTitle();
        
        
        Severity: Minor
        Found in includes/jobqueue/jobs/CategoryMembershipChangeJob.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 tagObj has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function tagObj( $parser, $frame, $args ) {
                if ( !count( $args ) ) {
                    return '';
                }
                $tagName = strtolower( trim( $frame->expand( array_shift( $args ) ) ) );
        Severity: Minor
        Found in includes/parser/CoreParserFunctions.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 getUserSig has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getUserSig( UserIdentity $user, $nickname = false, $fancySig = null ) {
                $username = $user->getName();
        
                # If not given, retrieve from the user object.
                if ( $nickname === false ) {
        Severity: Minor
        Found in includes/parser/Parser.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 getQueryInfo has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getQueryInfo() {
                $queryBuilder = DatabaseLogEntry::newSelectQueryBuilder( $this->mDb )
                    ->where( $this->mConds );
        
                # Add log_search table if there are conditions on it.
        Severity: Minor
        Found in includes/logging/LogPager.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 getExistsWarning has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function getExistsWarning( $file ) {
                if ( $file->exists() ) {
                    return [ 'warning' => 'exists', 'file' => $file ];
                }
        
        
        Severity: Minor
        Found in includes/upload/UploadBase.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 getParametersForApi has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function getParametersForApi() {
                $entry = $this->entry;
                $params = $entry->getParameters();
        
                static $map = [
        Severity: Minor
        Found in includes/logging/BlockLogFormatter.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 publish has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            public function publish( $newId, $to = 'rcandudp' ) {
                $canAddTags = true;
                // FIXME: this code should be removed once all callers properly call publish()
                if ( $to === 'udp' && !$newId && !$this->getAssociatedRevId() ) {
                    \MediaWiki\Logger\LoggerFactory::getInstance( 'logging' )->warning(
        Severity: Minor
        Found in includes/logging/ManualLogEntry.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