wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 2,096 of 2,096 total issues

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

        string $itemId,
        array $patch,
        array $editTags,
        bool $isBot,
        ?string $comment,

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

        public function __construct( string $propertyId,
            array $patch,
            array $editTags,
            bool $isBot,
            ?string $comment,

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

              string $itemId,
              array $patch,
              array $editTags,
              bool $isBot,
              ?string $comment,

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

            public function deserialize( array $serialization, string $basePath = '' ): Reference {
                if ( count( $serialization ) && array_is_list( $serialization ) ) {
                    throw new InvalidFieldException( '', $serialization, $basePath );
                }
        
        
        Severity: Minor
        Found in repo/rest-api/src/Application/Serialization/ReferenceDeserializer.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 assertValidStatements has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            private function assertValidStatements( array $serialization, Item $originalItem, array $originalStatementsSerialization ): void {
                $validationError = $this->statementsValidator->validateModifiedStatements(
                    $originalStatementsSerialization,
                    $originalItem->getStatements(),
                    $serialization['statements'] ?? [],

        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

                string $itemId,
                string $languageCode,
                array $editTags,
                bool $isBot,
                ?string $comment,

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

                  string $propertyId,
                  string $statementId,
                  array $editTags,
                  bool $isBot,
                  ?string $comment,

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

                    string $statementId,
                    array $patch,
                    array $editTags,
                    bool $isBot,
                    ?string $comment,

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

                      string $itemId,
                      string $siteId,
                      array $editTags,
                      bool $isBot,
                      ?string $comment,

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

                        AddPropertyStatementValidator $validator,
                        AssertPropertyExists $assertPropertyExists,
                        PropertyWriteModelRetriever $propertyRetriever,
                        GuidGenerator $guidGenerator,
                        PropertyUpdater $propertyUpdater,

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

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

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

                        public function saveEntity( EntityDocument $entity, $summary, User $user, $flags = 0, $baseRevId = false, array $tags = [] );
                    Severity: Minor
                    Found in lib/includes/Store/EntityStore.php - About 45 mins to fix

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

                          private function insertNonExistingRecords(
                              array $records,
                              ?callable $recordsToInsertDecoratorCallback = null
                          ): array {
                              if ( !$records ) {

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

                          private function addLanguageAndVariantsToChain( $language, array &$chain, array &$fetched ): void {
                              $languageCode = is_string( $language ) ? $language : $language->getCode();
                      
                              $this->addLanguageToChain( $language, $chain, $fetched );
                      
                      
                      Severity: Minor
                      Found in lib/includes/LanguageFallbackChainFactory.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

                              LabelDescriptionLookup $labelDescriptionLookup,
                              LanguageNameLookup $languageNameLookup,
                              EntityExistenceChecker $entityExistenceChecker,
                              EntityTitleTextLookup $entityTitleTextLookup,
                              EntityUrlLookup $entityUrlLookup,
                      Severity: Minor
                      Found in lib/includes/Formatters/LabelsProviderEntityIdHtmlLinkFormatter.php - About 45 mins to fix

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

                            public function resolveGroupedTermInLangIds(
                                array $groupedTermInLangIds,
                                array $types = null,
                                array $languages = null
                            ): array {
                        Severity: Minor
                        Found in lib/includes/Store/Sql/Terms/DatabaseTermInLangIdsResolver.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 resolveTermsViaJoin has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                $joinTable,
                                $joinColumn,
                                $groupColumn,
                                array $conditions,
                                array $types = null,
                        Severity: Minor
                        Found in lib/includes/Store/Sql/Terms/DatabaseTermInLangIdsResolver.php - About 45 mins to fix

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

                                  TemplateFactory $templateFactory,
                                  LanguageNameLookup $languageNameLookup,
                                  LocalizedTextProvider $textProvider,
                                  LanguageDirectionalityLookup $languageDirectionalityLookup,
                                  LanguageFallbackChainFactory $languageFallbackChainFactory,
                          Severity: Minor
                          Found in view/src/TermsListView.php - About 45 mins to fix

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

                                    string $key,
                                    array $value,
                                    array $defaultValue,
                                    array $twoDArrayMerge,
                                    array $overrideArrays,
                            Severity: Minor
                            Found in lib/includes/WikibaseSettings.php - About 45 mins to fix

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

                                  public function loadEntityDataFromWikiPageRevision( RevisionRecord $revision, string $slotRole, int $revStoreFlags ) {
                                      // NOTE: Support for cross-wiki content access in RevisionStore is incomplete when,
                                      // reading from the pre-MCR database schema, see T201194.
                                      // For that reason, we have to load and decode the content blob directly,
                                      // instead of using RevisionRecord::getContent() or SlotRecord::getContent().
                              Severity: Minor
                              Found in lib/includes/Store/Sql/WikiPageEntityDataLoader.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

                              Severity
                              Category
                              Status
                              Source
                              Language