wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

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

    public function __construct(
        ServiceOptions $options,
        BlockRestrictionStore $blockRestrictionStore,
        BlockPermissionCheckerFactory $blockPermissionCheckerFactory,
        BlockUtils $blockUtils,
Severity: Minor
Found in includes/block/BlockUser.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 subPageSubtitleInternal has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function subPageSubtitleInternal() {
        $services = MediaWikiServices::getInstance();
        $linkRenderer = $services->getLinkRenderer();
        $out = $this->getOutput();
        $title = $out->getTitle();
Severity: Minor
Found in includes/skins/Skin.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(
        $url, array $options, $caller = __METHOD__, Profiler $profiler = null
    ) {
        $this->urlUtils = MediaWikiServices::getInstance()->getUrlUtils();
        if ( !array_key_exists( 'timeout', $options )
Severity: Minor
Found in includes/http/MWHttpRequest.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 generateTOC has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private static function generateTOC( ?TOCData $tocData, Language $lang = null, array $options = [] ): string {
        $toc = '';
        $lastLevel = 0;
        $maxTocLevel = $options['maxtoclevel'] ?? null;
        if ( $maxTocLevel === null ) {
Severity: Minor
Found in includes/OutputTransform/Stages/HandleTOCMarkers.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 readPHPFile has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected function readPHPFile( $_fileName, $_fileType ) {
        include $_fileName;

        $data = [];
        if ( $_fileType == 'core' ) {
Severity: Minor
Found in includes/language/LocalisationCache.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 parseRules has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function parseRules() {
        $rules = $this->mRules;
        $bidtable = [];
        $unidtable = [];
        $varsep_pattern = $this->mConverter->getVarSeparatorPattern();
Severity: Minor
Found in includes/language/ConverterRule.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 getMetadataArray has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function getMetadataArray() {
        // this seems a bit ugly... This is all so its merged in right order
        // based on the MWG recommendation.
        $temp = [];
        krsort( $this->metaPriority );
Severity: Minor
Found in includes/media/BitmapMetadataHandler.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 detectServer has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public static function detectServer( $assumeProxiesUseDefaultProtocolPorts = null ) {
        $assumeProxiesUseDefaultProtocolPorts ??= $GLOBALS['wgAssumeProxiesUseDefaultProtocolPorts'];

        $proto = self::detectProtocol();
        $stdPort = $proto === 'https' ? 443 : 80;
Severity: Minor
Found in includes/Request/WebRequest.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 format has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function format( string $format ): string {
        $string = $this->fetchMessage();

        if ( $string === false ) {
            // Err on the side of safety, ensure that the output
Severity: Minor
Found in includes/Message/Message.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() {
        // Check whether upload is enabled
        if ( !UploadBase::isEnabled() ) {
            $this->dieWithError( 'uploaddisabled' );
        }
Severity: Minor
Found in includes/api/ApiUpload.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 verifyUpload has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected function verifyUpload() {
        if ( $this->mParams['chunk'] ) {
            $maxSize = UploadBase::getMaxUploadSize();
            if ( $this->mParams['filesize'] > $maxSize ) {
                $this->dieWithError( 'file-too-large' );
Severity: Minor
Found in includes/api/ApiUpload.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 getText has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function getText() {
        if ( isset( self::$blobCache[$this->mOldId] ) ) {
            $obj = self::$blobCache[$this->mOldId];
        } else {
            $dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
Severity: Minor
Found in includes/historyblob/HistoryBlobStub.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 preUpgrade has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function preUpgrade() {
        global $wgDBuser, $wgDBpassword;

        $status = $this->getConnection( self::CONN_CREATE_TABLES );
        if ( !$status->isOK() ) {
Severity: Minor
Found in includes/installer/MysqlInstaller.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 setValue has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public static function setValue( array &$arr, $name, $value, $flags = 0 ) {
        if ( ( $flags & self::NO_VALIDATE ) !== self::NO_VALIDATE ) {
            $value = self::validateValue( $value );
        }

Severity: Minor
Found in includes/api/ApiResult.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() {
        $this->checkUserRightsAny( 'block' );
        $params = $this->extractRequestParams();
        $this->requireOnlyOneParameter( $params, 'user', 'userid' );

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

    protected function substituteResultWithError( Throwable $e ) {
        $result = $this->getResult();
        $formatter = $this->getErrorFormatter();
        $config = $this->getConfig();
        $errorCodes = [];
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

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

    public static function getHelp( IContextSource $context, $modules, array $options ) {
        if ( !is_array( $modules ) ) {
            $modules = [ $modules ];
        }

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

    protected function showForm() {
        $userAllowed = true;

        // Messages: revdelete-selected-text, revdelete-selected-file, logdelete-selected
        $out = $this->getOutput();
Severity: Minor
Found in includes/specials/SpecialRevisionDelete.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( $par ) {
        $this->useTransactionalTimeLimit();

        $this->checkPermissions();
        $this->checkReadOnly();
Severity: Minor
Found in includes/specials/SpecialRevisionDelete.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 dispatch has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private function dispatch() {
        // the various namespaces supported by Special:Redirect
        switch ( $this->mType ) {
            case 'user':
                $status = $this->dispatchUser();
Severity: Minor
Found in includes/specials/SpecialRedirect.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