wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 2,096 of 2,096 total issues

Method addValue has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        RdfWriter $writer,
        $propertyValueNamespace,
        $propertyValueLName,
        $dataType,
        $snakNamespace,
Severity: Minor
Found in repo/includes/Rdf/Values/LiteralValueRdfBuilder.php - About 45 mins to fix

    Method addValue has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            RdfWriter $writer,
            $propertyValueNamespace,
            $propertyValueLName,
            $dataType,
            $snakNamespace,
    Severity: Minor
    Found in repo/includes/Rdf/Values/GlobeCoordinateRdfBuilder.php - About 45 mins to fix

      Function run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function run( $new, IContextSource $context, string $summary ) {
              $filterStatus = Status::newGood();
      
              if ( !$this->hookContainer->isRegistered( 'EditFilterMergedContent' ) ) {
                  return $filterStatus;
      Severity: Minor
      Found in repo/includes/EditEntity/MediaWikiEditFilterHookRunner.php - About 45 mins 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 setServices has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              SqlEntityIdPagerFactory $sqlEntityIdPagerFactory,
              array $existingEntityTypes,
              array $entityTypesWithoutRdfOutput,
              EntityPrefetcher $entityPrefetcher,
              EntityRevisionLookup $entityRevisionLookup,
      Severity: Minor
      Found in repo/maintenance/dumpRdf.php - About 45 mins to fix

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

            public function __construct(
                EntityHolder $itemHolder = null,
                EntityRedirect $entityRedirect = null,
                Title $redirectTitle = null
            ) {
        Severity: Minor
        Found in repo/includes/Content/ItemContent.php - About 45 mins 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 getMonthNameUnlocalizer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getMonthNameUnlocalizer() {
                $languageCode = $this->options->getOption( ValueParser::OPT_LANG );
        
                if ( $languageCode === self::CANONICAL_LANGUAGE_CODE ) {
                    $replacements = [];
        Severity: Minor
        Found in repo/includes/Parsers/TimeParserFactory.php - About 45 mins 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 applyGlobals has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function applyGlobals() {
                $optionsData = $this->getOption( 'options', 'false' );
                if ( substr_compare( $optionsData, 'B64://', 0, strlen( 'B64://' ) ) === 0 ) {
                    $optionsData = base64_decode( substr( $optionsData, strlen( 'B64://' ) ) );
                }
        Severity: Minor
        Found in repo/maintenance/searchEntities.php - About 45 mins 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 saveEntity has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                EntityDocument $entity,
                $summary,
                User $user,
                $flags = 0,
                $baseRevId = false,
        Severity: Minor
        Found in repo/includes/EditEntity/StatsdSaveTimeRecordingEntityStore.php - About 45 mins to fix

          Method build has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  OutputPage $out,
                  $rightsUrl,
                  $rightsText,
                  array $badgeItems,
                  $stringLimit,
          Severity: Minor
          Found in repo/includes/OutputPageJsConfigBuilder.php - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if ( isset( $date['second'] ) ) {
                                        $precision = TimeValue::PRECISION_SECOND;
                                        $time[5] = $this->parseFormattedNumber( $date['second'] );
                                    }
            Severity: Major
            Found in repo/includes/Parsers/DateFormatParser.php - About 45 mins to fix

              Function chooseAndParseNumber has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function chooseAndParseNumber( Language $lang, $matches, $precision, $isBceMsg ) {
                      $year = null;
                      foreach ( $matches as $number ) {
                          if ( $number === '' ) {
                              continue;
              Severity: Minor
              Found in repo/includes/Parsers/MwTimeIsoParser.php - About 45 mins 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 saveRedirect has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      EntityRedirect $redirect,
                      $summary,
                      User $user,
                      $flags = 0,
                      $baseRevId = false,
              Severity: Minor
              Found in repo/includes/EditEntity/StatsdSaveTimeRecordingEntityStore.php - About 45 mins to fix

                Function getEntity has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getEntity( $expectedClass = EntityDocument::class ) {
                        if ( !$this->entity ) {
                            $this->entity = $this->codec->decodeEntity( $this->blob, $this->contentFormat );
                
                            if ( !( $this->entity instanceof EntityDocument ) ) {
                Severity: Minor
                Found in repo/includes/Content/DeferredDecodingEntityHolder.php - About 45 mins 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 attemptSave has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        EntityDocument $newEntity,
                        string $summary,
                        $flags,
                        $token,
                        $watch = null,
                Severity: Minor
                Found in repo/includes/EditEntity/EditEntity.php - About 45 mins to fix

                  Method attemptSave has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public function attemptSave( EntityDocument $newEntity, string $summary, $flags, $token, $watch = null, array $tags = [] ) {
                  Severity: Minor
                  Found in repo/includes/EditEntity/MediaWikiEditEntity.php - About 45 mins to fix

                    Function getRegexpsFromMessageText has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function getRegexpsFromMessageText( string $msgText ): array {
                            static $pluralRegex = null;
                            if ( $pluralRegex === null ) {
                                // We need to match on a preg_quoted string here, so double quote
                                $pluralRegex = '@' . preg_quote( preg_quote( '{{PLURAL:$1|' ) ) .
                    Severity: Minor
                    Found in repo/includes/Parsers/MwTimeIsoParser.php - About 45 mins 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 deserialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function deserialize( string $dataTypeId, array $valueSerialization, string $basePath = '' ): DataValue {
                            $this->assertFieldExists( $valueSerialization, 'content', $basePath );
                    
                            // phpcs:ignore Generic.CodeAnalysis.AssignmentInCondition.Found
                            switch ( $dataValueType = $this->valueTypeLookup->getValueType( $dataTypeId ) ) {
                    Severity: Minor
                    Found in repo/rest-api/src/Infrastructure/DataValuesValueDeserializer.php - About 45 mins 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 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function execute(): void {
                            if ( !WikibaseSettings::isRepoEnabled() ) {
                                $this->output( "You need to have Wikibase enabled in order to use this maintenance script!\n\n" );
                                exit;
                            }
                    Severity: Minor
                    Found in repo/maintenance/rebuildItemsPerSite.php - About 45 mins 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 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            ItemId $id,
                            Labels $labels,
                            Descriptions $descriptions,
                            Aliases $aliases,
                            Sitelinks $sitelinks,
                    Severity: Minor
                    Found in repo/rest-api/src/Domain/ReadModel/Item.php - About 45 mins to fix

                      Function assertValidStatements has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function assertValidStatements(
                              array $statementsSerialization,
                              Property $originalProperty,
                              array $originalStatementsSerialization
                          ): void {

                      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