wikimedia/mediawiki-core

View on GitHub

Showing 11,545 of 11,545 total issues

Method addParserOutputMetadata has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function addParserOutputMetadata( ParserOutput $parserOutput ) {
        // T301020 This should eventually use the standard "merge ParserOutput"
        // function between $parserOutput and $this->metadata.
        $this->addLanguageLinks( $parserOutput->getLanguageLinks() );
        $this->addCategoryLinks( $parserOutput->getCategoryMap() );
Severity: Major
Found in includes/Output/OutputPage.php - About 3 hrs to fix

    File MessagesBn.php has 310 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /** Bengali (বাংলা)
     *
     * @file
     * @ingroup Languages
    Severity: Minor
    Found in languages/messages/MessagesBn.php - About 3 hrs to fix

      File MessagesEs.php has 310 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /** Spanish (español)
       *
       * @file
       * @ingroup Languages
      Severity: Minor
      Found in languages/messages/MessagesEs.php - About 3 hrs to fix

        Method execute has 86 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function execute() {
                $doDelete = $this->hasOption( 'delete' );
                $doDeleteTalk = $this->hasOption( 'delete-talk' );
                $langCode = $this->getOption( 'lang-code' );
        
        
        Severity: Major
        Found in maintenance/deleteEqualMessages.php - About 3 hrs to fix

          Method doDBUpdates has 86 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function doDBUpdates() {
                  $mode = $this->getOption( 'mode', 'both' );
                  $begin = $this->getOption( 'begin', '' );
                  $throttle = $this->getOption( 'throttle', 0 );
          
          
          Severity: Major
          Found in maintenance/cleanupEmptyCategories.php - About 3 hrs to fix

            Function checkCascadingSourcesRestrictions has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                private function checkCascadingSourcesRestrictions(
                    $action,
                    UserIdentity $user,
                    PermissionStatus $status,
                    $rigor,
            Severity: Minor
            Found in includes/Permissions/PermissionManager.php - About 3 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 getSessionInfoForRequest has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                private function getSessionInfoForRequest( WebRequest $request ) {
                    // Call all providers to fetch "the" session
                    $infos = [];
                    foreach ( $this->getProviders() as $provider ) {
                        $info = $provider->provideSessionInfo( $request );
            Severity: Minor
            Found in includes/session/SessionManager.php - About 3 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 view has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                public function view() {
                    $context = $this->getContext();
                    $showEXIF = $context->getConfig()->get( MainConfigNames::ShowEXIF );
            
                    // For action=render, include body text only; none of the image extras
            Severity: Minor
            Found in includes/page/ImagePage.php - About 3 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 24 (exceeds 5 allowed). Consider refactoring.
            Open

                public function run( $action, $module ) {
                    $actions = [ 'update', 'verify', 'make-sri', 'make-cdx' ];
                    if ( !in_array( $action, $actions ) ) {
                        $this->error( "Invalid action.\n\nMust be one of " . implode( ', ', $actions ) . '.' );
                        return false;
            Severity: Minor
            Found in includes/ResourceLoader/ForeignResourceManager.php - About 3 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 providerAllowsAuthenticationDataChange has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                public function providerAllowsAuthenticationDataChange(
                    AuthenticationRequest $req, $checkData = true
                ) {
                    if ( get_class( $req ) !== TemporaryPasswordAuthenticationRequest::class ) {
                        // We don't really ignore it, but this is what the caller expects.

            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 getDirListPageInternal has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getDirListPageInternal( $fullCont, $dir, &$after, $limit, array $params ) {
                    $dirs = [];
                    if ( $after === INF ) {
                        return $dirs; // nothing more
                    }
            Severity: Minor
            Found in includes/libs/filebackend/SwiftFileBackend.php - About 3 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 freeLocksOnServer has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function freeLocksOnServer( $lockSrv, array $pathsByType ) {
                    $status = StatusValue::newGood();
            
                    $memc = $this->getCache( $lockSrv );
                    // List of affected paths
            Severity: Minor
            Found in includes/libs/lockmanager/MemcLockManager.php - About 3 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 validateCookieDomain has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function validateCookieDomain( $domain, $originDomain = null ) {
                    $dc = explode( ".", $domain );
            
                    // Don't allow a trailing dot or addresses without a or just a leading dot
                    if ( substr( $domain, -1 ) == '.' ||
            Severity: Minor
            Found in includes/libs/Cookie.php - About 3 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 _load_items has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                function _load_items( $sock, &$ret, &$casToken = null ) {
                    $results = array();
            
                    while ( 1 ) {
                        $decl = $this->_fgets( $sock );
            Severity: Minor
            Found in includes/libs/objectcache/utils/MemcachedClient.php - About 3 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 parseMimeInfo has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function parseMimeInfo( string $rawMimeInfo ): void {
                    $rawMimeInfo = str_replace( [ "\r\n", "\n\r", "\n\n", "\r\r", "\r" ], "\n", $rawMimeInfo );
                    $rawMimeInfo = str_replace( "\t", " ", $rawMimeInfo );
            
                    $lines = explode( "\n", $rawMimeInfo );
            Severity: Minor
            Found in includes/libs/mime/MimeAnalyzer.php - About 3 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 loadDataFromRequest has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                public function loadDataFromRequest( $request ) {
                    // It's possible that this might be posted with no fields. Detect that
                    // by looking for an edit token.
                    if ( !$request->getCheck( 'wpEditToken' ) && $request->getArray( $this->mName ) === null ) {
                        return $this->getDefault();
            Severity: Minor
            Found in includes/htmlform/fields/HTMLFormFieldCloner.php - About 3 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 getContributors has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function getContributors( $cnt, $showIfMax ) {
                    $contributors = $this->getWikiPage()->getContributors();
            
                    $others_link = false;
            
            
            Severity: Minor
            Found in includes/actions/CreditsAction.php - About 3 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 getMessageForLang has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                private function getMessageForLang( $lang, $lckey, $useDB, &$alreadyTried ) {
                    $langcode = $lang->getCode();
            
                    // Try checking the database for the requested language
                    if ( $useDB ) {
            Severity: Minor
            Found in includes/language/MessageCache.php - About 3 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 applyDefaultConfig has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                public function applyDefaultConfig( array $lbConf ): array {
                    $this->options->assertRequiredOptions( self::APPLY_DEFAULT_CONFIG_OPTIONS );
            
                    $typesWithSchema = self::getDbTypesWithSchemas();
                    if ( Profiler::instance() instanceof ProfilerStub ) {
            Severity: Minor
            Found in includes/db/MWLBFactory.php - About 3 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 parseFlags has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                private function parseFlags() {
                    $text = $this->mText;
                    $flags = [];
                    $variantFlags = [];
            
            
            Severity: Minor
            Found in includes/language/ConverterRule.php - About 3 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