wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 2,096 of 2,096 total issues

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

    protected function validateParameters( array $params ): void {
        $entityReferenceBySiteLinkGiven = isset( $params['site'] ) && isset( $params['title'] );
        $entityReferenceBySiteLinkPartial = ( isset( $params['site'] ) xor isset( $params['title'] ) );
        $entityIdGiven = isset( $params['id'] );
        $shouldCreateNewWithSomeType = isset( $params['new'] );
Severity: Minor
Found in repo/includes/Api/ModifyEntity.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 onArticleDeleteComplete has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        WikiPage $wikiPage,
        User $user,
        $reason,
        $id,
        ?Content $content,
Severity: Minor
Found in repo/includes/RepoHooks.php - About 45 mins to fix

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

        public static function onFormat( &$comment, $pre, $auto, $post, $title, $local ) {
    Severity: Minor
    Found in repo/includes/RepoHooks.php - About 45 mins to fix

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

              $text,
              $languageCode,
              $entityType,
              $limit,
              $strictLanguage,
      Severity: Minor
      Found in repo/includes/Api/CombinedEntitySearchHelper.php - About 45 mins to fix

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

                $text,
                $languageCode,
                $entityType,
                $limit,
                $strictLanguage,
        Severity: Minor
        Found in repo/includes/Api/TypeDispatchingEntitySearchHelper.php - About 45 mins to fix

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

                  $text,
                  $languageCode,
                  $entityType,
                  $limit,
                  $strictLanguage,
          Severity: Minor
          Found in repo/includes/Api/ConceptUriSearchHelper.php - About 45 mins to fix

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

                    $linkRenderer,
                    $target,
                    $isKnown,
                    &$text,
                    &$extraAttribs,
            Severity: Minor
            Found in repo/includes/Hooks/HtmlPageLinkRendererEndHookHandler.php - About 45 mins to fix

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

                      $text,
                      $languageCode,
                      $entityType,
                      $limit,
                      $strictLanguage,
              Severity: Minor
              Found in repo/includes/Api/PropertyDataTypeSearchHelper.php - About 45 mins to fix

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

                        $text,
                        $languageCode,
                        $entityType,
                        $limit,
                        $strictLanguage,
                Severity: Minor
                Found in repo/includes/Api/FedPropertiesTypeDispatchingEntitySearchHelper.php - About 45 mins to fix

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

                          ApiMain $mainModule,
                          string $moduleName,
                          ItemMergeInteractor $interactor,
                          ApiErrorReporter $errorReporter,
                          callable $resultBuilderInstantiator,
                  Severity: Minor
                  Found in repo/includes/Api/MergeItems.php - About 45 mins to fix

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

                            $text,
                            $languageCode,
                            $entityType,
                            $limit,
                            $strictLanguage,
                    Severity: Minor
                    Found in repo/includes/Api/EntityTermSearchHelper.php - About 45 mins to fix

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

                          public static function onRevisionFromEditComplete(
                              WikiPage $wikiPage,
                              RevisionRecord $revisionRecord,
                              $baseID,
                              UserIdentity $user
                      Severity: Minor
                      Found in repo/includes/RepoHooks.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

                              $maxLength,
                              array $languageCodes,
                              EntityIdParser $idParser,
                              TermsCollisionDetectorFactory $termsCollisionDetectorFactory,
                              TermLookup $termLookup,
                      Severity: Minor
                      Found in repo/includes/Validators/TermValidatorFactory.php - About 45 mins to fix

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

                                ApiMain $apiMain,
                                string $moduleName,
                                IBufferingStatsdDataFactory $dataFactory,
                                ApiHelperFactory $apiHelperFactory,
                                EntityIdFormatterFactory $entityIdFormatterFactory,
                        Severity: Minor
                        Found in repo/includes/Api/FormatEntities.php - About 45 mins to fix

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

                                  ApiMain $mainModule,
                                  string $moduleName,
                                  ApiHelperFactory $apiHelperFactory,
                                  EntityIdParser $entityIdParser,
                                  StatementGuidParser $statementGuidParser,
                          Severity: Minor
                          Found in repo/includes/Api/GetClaims.php - About 45 mins to fix

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

                                private function searchEntities( $text, $languageCode, $entityType, $limit, $prefixSearch, $strictLanguage ) {
                            Severity: Minor
                            Found in repo/includes/Api/EntityTermSearchHelper.php - About 45 mins to fix

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

                                      RdfWriter $writer,
                                      $propertyValueNamespace,
                                      $propertyValueLName,
                                      $dataType,
                                      $snakNamespace,
                              Severity: Minor
                              Found in repo/includes/Rdf/Values/TimeRdfBuilder.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/ObjectUriRdfBuilder.php - About 45 mins to fix

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

                                      private function validateSiteLinkSerialization( $serialization, $siteCode, SiteList $sites = null ) {
                                          $this->assertArray( $serialization, 'An array was expected, but not found' );
                                  
                                          if ( !array_key_exists( 'site', $serialization ) ) {
                                              throw new ChangeOpDeserializationException( 'Site must be provided', 'no-site' );
                                  Severity: Minor
                                  Found in repo/includes/ChangeOp/Deserialization/SiteLinksChangeOpDeserializer.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 addValue has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

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