wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 2,096 of 2,096 total issues

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

        array $tags,
        ChangeOpFactoryProvider $changeOpFactoryProvider,
        SpecialPageCopyrightView $copyrightView,
        SummaryFormatter $summaryFormatter,
        EntityTitleLookup $entityTitleLookup,
Severity: Major
Found in repo/includes/Specials/SpecialSetDescription.php - About 1 hr to fix

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

            ApiMain $mainModule,
            string $moduleName,
            callable $errorReporterInstantiator,
            StatementChangeOpFactory $statementChangeOpFactory,
            StatementModificationHelper $modificationHelper,
    Severity: Major
    Found in repo/includes/Api/SetQualifier.php - About 1 hr to fix

      Method factory has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              LanguageNameUtils $languageNameUtils,
              Config $mwConfig,
              AnonymousEditWarningBuilder $anonymousEditWarningBuilder,
              ChangeOpFactoryProvider $changeOpFactoryProvider,
              MediaWikiEditEntityFactory $editEntityFactory,
      Severity: Major
      Found in repo/includes/Specials/SpecialSetLabelDescriptionAliases.php - About 1 hr to fix

        Function filterEntitySerializationUsingProps has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            private function filterEntitySerializationUsingProps( array $serialization, $props ) {
                if ( $props !== 'all' ) {
                    if ( !in_array( 'labels', $props ) ) {
                        unset( $serialization['labels'] );
                    }
        Severity: Minor
        Found in repo/includes/Api/ResultBuilder.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

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

                ApiMain $mainModule,
                string $moduleName,
                IBufferingStatsdDataFactory $statsdDataFactory,
                EntityRevisionLookup $revisionLookup,
                EntityIdParser $idParser,
        Severity: Major
        Found in repo/includes/Api/EditEntity.php - About 1 hr to fix

          Function onBeforePageDisplay has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function onBeforePageDisplay( OutputPage $out, Skin $skin ) {
                  $entityNamespaceLookup = WikibaseRepo::getEntityNamespaceLookup();
                  $namespace = $out->getTitle()->getNamespace();
                  $isEntityTitle = $entityNamespaceLookup->isNamespaceWithEntities( $namespace );
                  $settings = WikibaseRepo::getSettings();
          Severity: Minor
          Found in repo/includes/RepoHooks.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 validateEntitySpecificParameters has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function validateEntitySpecificParameters(
                  array $preparedParameters,
                  EntityDocument $entity,
                  int $baseRevId
              ): void {
          Severity: Minor
          Found in repo/includes/Api/EditEntity.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

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

                  ApiMain $mainModule,
                  string $moduleName,
                  SiteLinkStore $siteLinkStore,
                  SiteLinkGlobalIdentifiersProvider $siteLinkGlobalIdentifiersProvider,
                  SiteLinkTargetProvider $siteLinkTargetProvider,
          Severity: Major
          Found in repo/includes/Api/LinkTitles.php - About 1 hr to fix

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

                    ApiMain $mainModule,
                    string $moduleName,
                    ApiErrorReporter $errorReporter,
                    StatementChangeOpFactory $statementChangeOpFactory,
                    StatementModificationHelper $modificationHelper,
            Severity: Major
            Found in repo/includes/Api/RemoveReferences.php - About 1 hr to fix

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

                      OutputPageEntityViewChecker $entityViewChecker,
                      OutputPageJsConfigBuilder $outputPageJsConfigBuilder,
                      ContentLanguages $termsLanguages,
                      UserLanguageLookup $userLanguageLookup,
                      UserPreferredContentLanguagesLookup $userPreferredContentLanguagesLookup,
              Severity: Major
              Found in repo/includes/Hooks/MakeGlobalVariablesScriptHookHandler.php - About 1 hr to fix

                Function addValue has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function addValue(
                        RdfWriter $writer,
                        $propertyValueNamespace,
                        $propertyValueLName,
                        $dataType,
                Severity: Minor
                Found in repo/includes/Rdf/Values/QuantityRdfBuilder.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 createEntityChangeOp has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function createEntityChangeOp( array $changeRequest ) {
                        $this->assertArray( $changeRequest['sitelinks'], 'List of sitelinks must be an array' );
                
                        $siteLinksChangeOps = new ChangeOps();
                        $sites = $this->siteLinkTargetProvider->getSiteList( $this->siteLinkGroups );

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

                    private function fixEditConflict( EntityDocument $newEntity ): ?EntityDocument {
                        $baseRev = $this->getBaseRevision();
                        $latestRev = $this->getLatestRevision();
                
                        if ( !$latestRev ) {
                Severity: Minor
                Found in repo/includes/EditEntity/MediaWikiEditEntity.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 deserialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function deserialize( string $siteId, array $serialization, string $basePath = '' ): SiteLink {
                        if ( !array_key_exists( 'title', $serialization ) ) {
                            throw new MissingFieldException( 'title', $basePath );
                        }
                
                

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

                    private function getCacheKeys( array $entityIds, array $termTypes, array $languageCodes ): array {
                        $cacheKeys = [];
                        $unresolvedIds = [];
                        $keyPartsMap = [];
                        foreach ( $entityIds as $entityId ) {
                Severity: Minor
                Found in lib/includes/Store/CachingPrefetchingTermLookup.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 acquireTermInLangIds has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function acquireTermInLangIds( array $termsArray, $callback = null ): array {
                        $ids = [];
                
                        foreach ( $termsArray as $type => $termsOfType ) {
                            foreach ( $termsOfType as $lang => $terms ) {
                Severity: Minor
                Found in lib/includes/Store/Sql/Terms/InMemoryTermStore.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 updateQueryBuilder has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function updateQueryBuilder( SelectQueryBuilder $queryBuilder, array $entityIds, IReadableDatabase $db ) {
                        $where = [];
                        $joinSlotsTable = false;
                
                        foreach ( $entityIds as $entityId ) {
                Severity: Minor
                Found in lib/includes/Store/Sql/PageTableEntityQueryBase.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 getEntityRevisionFromCache has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getEntityRevisionFromCache(
                        EntityId $entityId,
                        $revisionId = 0,
                        $mode = LookupConstants::LATEST_FROM_REPLICA
                    ) {
                Severity: Minor
                Found in lib/includes/Store/CacheRetrievingEntityRevisionLookup.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 trimStatementGroup has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    private trimStatementGroup(
                        newStatements: readonly Statement[],
                        baseStatements: readonly Statement[],
                    ): Statement[] | null {
                        const baseStatementsById = statementListById( baseStatements );
                Severity: Minor
                Found in client/data-bridge/src/data-access/TrimmingWritingRepository.ts - 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

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

                        EntityIdParser $entityIdParser,
                        EntityIdComposer $entityIdComposer,
                        Deserializer $dataValueDeserializer,
                        NameTableStoreFactory $nameTableStoreFactory,
                        DataAccessSettings $dataAccessSettings,
                Severity: Major
                Found in data-access/src/SingleEntitySourceServicesFactory.php - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language