wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Function charCodeString has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function charCodeString( $prop ) {
        if ( isset( $this->mFilteredExifData[$prop] ) ) {
            if ( strlen( $this->mFilteredExifData[$prop] ) <= 8 ) {
                // invalid. Must be at least 9 bytes long.

Severity: Minor
Found in includes/media/Exif.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 read has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function read() {
        $keepReading = $this->reader->read();

        /* Skip until first element */
        while ( $keepReading && $this->reader->nodeType !== XMLReader::ELEMENT ) {
Severity: Minor
Found in includes/media/SVGReader.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 parseParameters has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function parseParameters( $par, FormOptions $opts ) {
        $stringParameterNameSet = [];
        $hideParameterNameSet = [];

        // URL parameters can be per-group, like 'userExpLevel',
Severity: Minor
Found in includes/specialpage/ChangesListSpecialPage.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 getPageList has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function getPageList(): array {
        if ( !is_array( $this->list ) ) {
            $this->list = self::CORE_LIST;

            if ( !$this->options->get( MainConfigNames::DisableInternalSearch ) ) {
Severity: Minor
Found in includes/specialpage/SpecialPageFactory.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 getPageRangesByDimensions has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getPageRangesByDimensions( $pagesByDimensions ) {
        $pageRangesByDimensions = [];

        foreach ( $pagesByDimensions as $dimensions => $pageList ) {
            $ranges = [];
Severity: Minor
Found in includes/media/MediaHandler.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 runUpdates has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function runUpdates( array $updates, $passSelf, $hasVirtualDomain = false ) {
        $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
        $updatesDone = [];
        $updatesSkipped = [];
        foreach ( $updates as $params ) {
Severity: Minor
Found in includes/installer/DatabaseUpdater.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 transformWarnings has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function transformWarnings( $warnings ) {
        if ( $warnings ) {
            // Add indices
            ApiResult::setIndexedTagName( $warnings, 'warning' );

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

    private function run( $resultPageSet = null ) {
        $params = $this->extractRequestParams();
        $search = $params['search'];
        $limit = $params['limit'];
        $offset = $params['offset'];
Severity: Minor
Found in includes/api/ApiQueryPrefixSearch.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 canCreateAccounts has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function canCreateAccounts() {
        $status = $this->getConnection( self::CONN_CREATE_DATABASE );
        if ( !$status->isOK() ) {
            return false;
        }
Severity: Minor
Found in includes/installer/MysqlInstaller.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 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function checkSettings( string $name, $settings, array $options, array $ret ): array {
        $map = $settings[self::PARAM_SUBMODULE_MAP] ?? [];
        if ( !is_array( $map ) ) {
            $ret['issues'][self::PARAM_SUBMODULE_MAP] = 'PARAM_SUBMODULE_MAP must be an array, got '
                . gettype( $map );
Severity: Minor
Found in includes/api/Validator/SubmoduleDef.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 loadRedirectTargets has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function loadRedirectTargets() {
        $titlesToResolve = [];
        $db = $this->getDB();

        if ( $this->mPendingRedirectIDs ) {
Severity: Minor
Found in includes/api/ApiPageSet.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 getAllowedParams has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAllowedParams( $flags = 0 ) {
        $feedFormatNames = array_keys( $this->getConfig()->get( MainConfigNames::FeedClasses ) );
        $ret = [
            'feedformat' => [
                ParamValidator::PARAM_DEFAULT => 'rss',
Severity: Minor
Found in includes/api/ApiFeedWatchlist.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 guessModel has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function guessModel( $role ) {
        $params = $this->extractRequestParams();

        foreach ( [ 'from', 'to' ] as $prefix ) {
            if ( $params["{$prefix}rev"] !== null ) {
Severity: Minor
Found in includes/api/ApiComparePages.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 checkAsserts has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function checkAsserts( $params ) {
        if ( isset( $params['assert'] ) ) {
            $user = $this->getUser();
            switch ( $params['assert'] ) {
                case 'anon':
Severity: Minor
Found in includes/api/ApiMain.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 logRequest has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function logRequest( $time, Throwable $e = null ) {
        $request = $this->getRequest();

        $user = $this->getUser();
        $performer = [
Severity: Minor
Found in includes/api/ApiMain.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 fetchBlobs has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function fetchBlobs( array $keys, bool $getCasToken = false ) {
        /** @noinspection PhpUnusedLocalVariableInspection */
        $silenceScope = $this->silenceTransactionProfiler();

        // Initialize order-preserved per-key results; set values for live keys below
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 execute has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $this->useTransactionalTimeLimit();

        $params = $this->extractRequestParams();

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

    protected function formatRsdApiList() {
        $apis = $this->getRsdApiList();

        $outputData = [];
        foreach ( $apis as $name => $info ) {
Severity: Minor
Found in includes/api/ApiRsd.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 load has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function load() {
        $this->loadStatus = new Status();

        $request = $this->getRequest();
        $this->searchEngineType = $request->getVal( 'srbackend' );
Severity: Minor
Found in includes/specials/SpecialSearch.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 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute( $par ) {
        $this->checkPermissions();
        $this->checkReadOnly();

        [ $this->target, $this->type ] = $this->getTargetAndType( $par, $this->getRequest() );
Severity: Minor
Found in includes/specials/SpecialUnblock.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