wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 1,432 of 2,096 total issues

Method getItem has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function getItem(): ?Item {
        $params = $this->getParams();
        $itemId = new ItemId( $params['entityId'] );
        try {
            $entity = $this->entityLookup->getEntity( $itemId );
Severity: Minor
Found in repo/includes/UpdateRepo/UpdateRepoJob.php - About 1 hr to fix

    Method onBeforePageDisplay has 26 lines of code (exceeds 25 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

      Method validateEntity has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function validateEntity( EntityDocument $entity ) {
              $entityId = $entity->getId()->getSerialization();
              $entityType = $entity->getType();
      
              if ( $entity instanceof LabelsProvider ) {
      Severity: Minor
      Found in repo/includes/Validators/LabelUniquenessValidator.php - About 1 hr to fix

        Method getFlavor has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function getFlavor( ?string $flavorName ): int {
                switch ( $flavorName ) {
                    case 'simple':
                        return RdfProducer::PRODUCE_TRUTHY_STATEMENTS
                            | RdfProducer::PRODUCE_SITELINKS
        Severity: Minor
        Found in repo/includes/LinkedData/EntityDataSerializationService.php - About 1 hr to fix

          Method validate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function validate( EntityDocument $entity ) {
                  if ( !( $entity instanceof DescriptionsProvider ) ) {
                      throw new InvalidArgumentException( '$entity must be a DescriptionsProvider' );
                  }
          
          
          Severity: Minor
          Found in repo/includes/ChangeOp/ChangeOpDescription.php - About 1 hr to fix

            Method factory has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function factory(
                    Language $contentLanguage,
                    HttpRequestFactory $httpRequestFactory,
                    IBufferingStatsdDataFactory $statsdDataFactory,
                    UserOptionsLookup $userOptionsLookup,
            Severity: Minor
            Found in repo/includes/Hooks/OutputPageBeforeHTMLHookHandler.php - About 1 hr to fix

              Method formatArg has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function formatArg( $arg ) {
                      try {
                          if ( $arg instanceof Snak ) {
                              return $this->snakFormatter->formatSnak( $arg );
                          } elseif ( $arg instanceof EntityId ) {
              Severity: Minor
              Found in repo/includes/SummaryFormatter.php - About 1 hr to fix

                Method validateBadgeSerialization has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function validateBadgeSerialization( array $serialization ) {
                        foreach ( $serialization as $badgeSerialization ) {
                            if ( !is_string( $badgeSerialization ) ) {
                                throw new ChangeOpDeserializationException(
                                    'Badges: a string was expected, but not found',

                  Method getValueBuilder has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function getValueBuilder( $dataTypeId, $dataValueType ) {
                          if ( $dataTypeId !== null ) {
                              if ( isset( $this->valueBuilders["PT:$dataTypeId"] ) ) {
                                  return $this->valueBuilders["PT:$dataTypeId"];
                              }
                  Severity: Minor
                  Found in repo/includes/Rdf/DispatchingValueSnakRdfBuilder.php - About 1 hr to fix

                    Method validate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function validate( EntityDocument $entity ) {
                            if ( !( $entity instanceof LabelsProvider ) ) {
                                throw new InvalidArgumentException( '$entity must be a LabelsProvider' );
                            }
                    
                    
                    Severity: Minor
                    Found in repo/includes/ChangeOp/ChangeOpLabel.php - About 1 hr to fix

                      Method addEntityPageProps has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function addEntityPageProps( EntityDocument $entity ): void {
                              if ( !$this->shouldProduce( RdfProducer::PRODUCE_PAGE_PROPS ) ) {
                                  return;
                              }
                              $pagePropertyDefs = $this->getPagePropertyDefs();
                      Severity: Minor
                      Found in repo/includes/Rdf/RdfBuilder.php - About 1 hr to fix

                        Method __construct has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function __construct() {
                                parent::__construct();
                        
                                $this->addDescription( 'Rebuilds entity quantity unit values' );
                        
                        
                        Severity: Minor
                        Found in repo/maintenance/rebuildEntityQuantityUnit.php - About 1 hr to fix

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

                              public function execute( PatchPropertyAliasesRequest $request ): PatchPropertyAliasesResponse {
                                  $deserializedRequest = $this->validator->validateAndDeserialize( $request );
                                  $editMetadata = $deserializedRequest->getEditMetadata();
                          
                                  $this->assertPropertyExists->execute( $deserializedRequest->getPropertyId() );

                            Method assertValidAliases has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function assertValidAliases( array $serialization ): void {
                                    $aliasesSerialization = $serialization[ 'aliases' ] ?? [];
                                    $validationError = $this->aliasesValidator->validate( $aliasesSerialization, '/aliases' );
                                    if ( $validationError ) {
                                        $errorCode = $validationError->getCode();

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

                                  public function execute( SetItemDescriptionRequest $request ): SetItemDescriptionResponse {
                                      $deserializedRequest = $this->validator->validateAndDeserialize( $request );
                                      $itemId = $deserializedRequest->getItemId();
                                      $description = $deserializedRequest->getItemDescription();
                                      $editMetadata = $deserializedRequest->getEditMetadata();

                                Method getHeadingHtml has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    protected function getHeadingHtml(
                                        $languageCode,
                                        EntityId $entityId = null,
                                        AliasGroupList $aliasGroups = null
                                    ) {
                                Severity: Minor
                                Found in view/src/SimpleEntityTermsView.php - About 1 hr to fix

                                  Method deserialize has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function deserialize( array $serialization, string $basePath = '' ): Statement {
                                          if ( count( $serialization ) && array_is_list( $serialization ) ) {
                                              throw new InvalidFieldTypeException( $serialization, $basePath );
                                          }
                                  
                                  

                                    Method assertValidLabelsAndDescriptions has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        private function assertValidLabelsAndDescriptions( array $serialization, Item $originalItem ): void {
                                            $labels = $serialization['labels'] ?? [];
                                            $descriptions = $serialization['descriptions'] ?? [];
                                            $validationError = $this->labelsSyntaxValidator->validate( $labels, '/labels' ) ??
                                                               $this->descriptionsSyntaxValidator->validate( $descriptions, '/descriptions' ) ??

                                      Method getEntityRevisionFromCache has 26 lines of code (exceeds 25 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

                                        Method selectFieldValuesForPrimaryKey has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            private function selectFieldValuesForPrimaryKey(
                                                string $table,
                                                string $selectedVar,
                                                string $primaryKeyVar,
                                                array $primaryKeyValues,
                                        Severity: Minor
                                        Found in lib/includes/Store/Sql/Terms/DatabaseInnerTermStoreCleaner.php - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language