wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Function listAuthors has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function listAuthors( $authors, $extName, $extDir ): string {
        $hasOthers = false;
        $linkRenderer = $this->getLinkRenderer();

        $list = [];
Severity: Minor
Found in includes/specials/SpecialVersion.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 getQueryInfo has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function getQueryInfo() {
        $dbr = $this->getDatabase();
        $conds = [];
        $options = [];

Severity: Minor
Found in includes/specials/pagers/UsersPager.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 getNormalForm has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getNormalForm() {
        $fields = [];
        $count = 0;

        // Allow subscribers to manipulate the list of watched pages (or use it
Severity: Minor
Found in includes/specials/SpecialEditWatchlist.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 __construct has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct(
        IContextSource $context,
        CommentStore $commentStore,
        LinkRenderer $linkRenderer,
        IConnectionProvider $dbProvider,
Severity: Minor
Found in includes/specials/pagers/ImageListPager.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 parsePar has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function parsePar( $par ) {
        // Testing for stringiness since we want to catch
        // the empty string to mean main namespace only.
        if ( is_string( $par ) ) {
            $ns = $this->getContentLanguage()->getNsIndex( $par );
Severity: Minor
Found in includes/specials/SpecialRandomPage.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 run has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function run() {
        $uploadThumbnailRenderMethod = MediaWikiServices::getInstance()
            ->getMainConfig()->get( MainConfigNames::UploadThumbnailRenderMethod );

        $transformParams = $this->params['transformParams'];
Severity: Minor
Found in includes/jobqueue/jobs/ThumbnailRenderJob.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 startTag has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function startTag( $name, Attributes $attrs, $selfClose, $sourceStart, $sourceLength ) {
        // Handle a start tag from the tokenizer: either relay it to the
        // next stage, or re-emit it as raw text.

        $badtag = false;
Severity: Minor
Found in includes/parser/RemexRemoveTagHandler.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 getCachedRevisionObject has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private static function getCachedRevisionObject( $parser, $title, $vary ) {
        if ( !$title ) {
            return null;
        }

Severity: Minor
Found in includes/parser/CoreParserFunctions.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 saveOptionsInternal has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function saveOptionsInternal( UserIdentity $user ): bool {
        if ( $this->userNameUtils->isIP( $user->getName() ) || $this->userNameUtils->isTemp( $user->getName() ) ) {
            throw new InvalidArgumentException( __METHOD__ . ' was called on IP or temporary user' );
        }

Severity: Minor
Found in includes/user/Options/UserOptionsManager.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 setProps has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected function setProps( $info ) {
        $this->dataLoaded = true;
        $fields = $this->getCacheFields( '' );
        $fields[] = 'fileExists';

Severity: Minor
Found in includes/filerepo/file/LocalFile.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 __construct has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct( array $info = null ) {
        // Verify required settings presence
        if (
            $info === null
            || !array_key_exists( 'name', $info )
Severity: Minor
Found in includes/filerepo/FileRepo.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 fetchParserOutputFromParsoid has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function fetchParserOutputFromParsoid( PageIdentity $page, $revision, bool $mayParse ): ?ParserOutput {
        $parserOptions = ParserOptions::newFromAnon();
        $parserOptions->setUseParsoid();

        try {
Severity: Minor
Found in includes/Rest/Handler/Helper/HtmlInputTransformHelper.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 getQueryConditions has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getQueryConditions( $filterEntry, array $options = [] ) {
        $options += [
            'protocol' => [ 'http://', 'https://' ],
            'oneWildcard' => false,
            'db' => null,
Severity: Minor
Found in includes/ExternalLinks/LinkFilter.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 shouldEmit has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public static function shouldEmit( $channel, $message, $level, $context ) {
        global $wgDebugLogFile, $wgDBerrorLog, $wgDebugLogGroups;

        if ( is_string( $level ) ) {
            $level = self::$levelMapping[$level];
Severity: Minor
Found in includes/debug/logger/LegacyLogger.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 render has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function render(
        $term,
        $offset,
        ISearchResultSet $titleResultSet = null,
        ISearchResultSet $textResultSet = null
Severity: Minor
Found in includes/search/searchwidgets/BasicSearchResultSetWidget.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 buildItems has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public static function buildItems( $rows ) {
        $items = [];

        # Merge adjacent edits by one user
        $sorted = [];
Severity: Minor
Found in includes/recentchanges/ChangesFeed.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 rebuildRecentChangesTablePass4 has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function rebuildRecentChangesTablePass4() {
        global $wgUseRCPatrol, $wgUseNPPatrol, $wgUseFilePatrol, $wgMiserMode;

        $dbw = $this->getPrimaryDB();

Severity: Minor
Found in maintenance/rebuildrecentchanges.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 factory has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    final public static function factory( array $params ): RCFeed {
        if ( !isset( $params['class'] ) ) {
            if ( !isset( $params['uri'] ) ) {
                throw new InvalidArgumentException( 'RCFeeds must have a class set' );
            }
Severity: Minor
Found in includes/recentchanges/RCFeed/RCFeed.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 showReport has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function showReport() {
        if ( !$this->prefetch ) {
            parent::showReport();

            return;
Severity: Minor
Found in maintenance/includes/TextPassDumper.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 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $performerName = $this->getOption( 'performer', false );
        $reason = $this->getOption( 'reason', '' );
        $unblocking = $this->getOption( 'unblock', false );
        $reblock = $this->hasOption( 'reblock' );
Severity: Minor
Found in maintenance/blockUsers.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