wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 2,096 of 2,096 total issues

Function exports has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = async function ( client, repoOwner, repoName, filePath ) {
    const history = [];

    let hasNextPage = true;
    let endCursor = null;
Severity: Minor
Found in build/dist-size/analyze/getHistoryForFile.js - About 1 hr to fix

    Method getAllowedParams has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function getAllowedParams(): array {
            return array_merge(
                [
                    'entity' => [
                        ParamValidator::PARAM_TYPE => 'string',
    Severity: Minor
    Found in repo/includes/Api/CreateClaim.php - About 1 hr to fix

      Method addEntityRevision has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function addEntityRevision(
              $sourceEntityIdSerialization,
              EntityRevision $entityRevision,
              $props = 'all',
              array $filterSiteIds = null,
      Severity: Minor
      Found in repo/includes/Api/ResultBuilder.php - About 1 hr to fix

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

            public function execute( $subPage ) {
                parent::execute( $subPage );
        
                // Setup
                $request = $this->getRequest();
        Severity: Minor
        Found in repo/includes/Specials/SpecialItemByTitle.php - About 1 hr to fix

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

              public function execute(): void {
                  $params = $this->extractRequestParams();
                  $this->validateParameters( $params );
          
                  $entityId = $this->guidParser->parse( $params['statement'] )->getEntityId();
          Severity: Minor
          Found in repo/includes/Api/SetReference.php - About 1 hr to fix

            Method getValidator has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getValidator( $scheme ) {
                    switch ( $scheme ) {
                        // Schemes with "://", copied from $wgUrlProtocols in MediaWiki's DefaultSettings.php
                        case 'ftp':
                        case 'ftps':
            Severity: Minor
            Found in repo/includes/Validators/UrlSchemeValidators.php - About 1 hr to fix

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

                Method doDBUpdates has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function doDBUpdates() {
                        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/rebuildPropertyInfo.php - About 1 hr to fix

                  Method newSuccessHttpResponse has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function newSuccessHttpResponse( CreatePropertyResponse $useCaseResponse ): Response {
                          $response = $this->getResponseFactory()->create();
                          $response->setStatus( 201 );
                          $response->setHeader( 'Content-Type', 'application/json' );
                          $response->setHeader(
                  Severity: Minor
                  Found in repo/rest-api/src/RouteHandlers/CreatePropertyRouteHandler.php - About 1 hr to fix

                    Method validateAndDeserialize has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function validateAndDeserialize( PropertyDescriptionEditRequest $request ): Term {
                            $property = $this->propertyRetriever->getPropertyWriteModel( new NumericPropertyId( $request->getPropertyId() ) );
                            $language = $request->getLanguageCode();
                            $description = $request->getDescription();
                    
                    

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

                          public function validate( array $statementSerialization, string $basePath = '' ): ?ValidationError {
                              try {
                                  $this->deserializedStatement = $this->deserializer->deserialize( $statementSerialization, $basePath );
                              } catch ( MissingFieldException $e ) {
                                  return new ValidationError(
                      Severity: Minor
                      Found in repo/rest-api/src/Application/Validation/StatementValidator.php - About 1 hr to fix

                        Method newFromArray has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function newFromArray( array $wellKnownPropertyIds, ?LoggerInterface $logger = null ): self {
                                $logger = $logger ?: new NullLogger();
                        
                                $referenceUrlPropertyId = self::parseWellKnownProperty( $wellKnownPropertyIds, 'referenceUrl', $logger );
                                $titlePropertyId = self::parseWellKnownProperty( $wellKnownPropertyIds, 'title', $logger );
                        Severity: Minor
                        Found in lib/includes/Formatters/Reference/WellKnownReferenceProperties.php - About 1 hr to fix

                          Method getFormatter has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function getFormatter( $dataValueType, $dataTypeId = null ): ValueFormatter {
                                  $formatter = null;
                          
                                  if ( $dataTypeId !== null ) {
                                      if ( isset( $this->formatters["PT:$dataTypeId"] ) ) {
                          Severity: Minor
                          Found in lib/includes/Formatters/DispatchingValueFormatter.php - About 1 hr to fix

                            Method loadEntityDataFromWikiPageRevision has 34 lines of code (exceeds 25 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 1 hr to fix

                              Identical blocks of code found in 2 locations. Consider refactoring.
                              Open

                                      destroy: function () {
                                          $( this.options.menu ).off( 'siteselector' );
                                          $.ui.suggester.prototype.destroy.call( this );
                                      },
                              client/resources/jquery.wikibase/jquery.wikibase.siteselector.js on lines 105..108

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 62.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Identical blocks of code found in 2 locations. Consider refactoring.
                              Open

                                      destroy: function () {
                                          $( this.options.menu ).off( 'siteselector' );
                                          $.ui.suggester.prototype.destroy.call( this );
                                      },
                              view/resources/jquery/wikibase/jquery.wikibase.siteselector.js on lines 102..105

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 62.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Identical blocks of code found in 2 locations. Consider refactoring.
                              Open

                                  function chain( tasks ) {
                                      return tasks.reduce( function ( promise, task ) {
                                          return promise.then( task );
                                      }, $.Deferred().resolve().promise() );
                                  }
                              view/resources/wikibase/entityChangers/EntityTermsChanger.js on lines 11..15

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 62.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Identical blocks of code found in 2 locations. Consider refactoring.
                              Open

                                  function chain( tasks ) {
                                      return tasks.reduce( function ( promise, task ) {
                                          return promise.then( task );
                                      }, $.Deferred().resolve().promise() );
                                  }
                              view/resources/wikibase/entityChangers/SiteLinkSetsChanger.js on lines 11..15

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 62.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 4 locations. Consider refactoring.
                              Open

                                  public get dataType() {
                                      return ( pathToSnak: PathToSnak ): DataType | null => {
                                          const snak = pathToSnak.resolveSnakInStatement( this.state );
                                          return snak?.datatype ?? null;
                                      };
                              Severity: Major
                              Found in client/data-bridge/src/store/statements/getters.ts and 3 other locations - About 1 hr to fix
                              client/data-bridge/src/store/statements/getters.ts on lines 39..44
                              client/data-bridge/src/store/statements/getters.ts on lines 46..51
                              client/data-bridge/src/store/statements/getters.ts on lines 53..58

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 62.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Similar blocks of code found in 2 locations. Consider refactoring.
                              Open

                                  public constructor(
                                      repoConfig: WbRepo,
                                      wikiUrlencode: MwUtilWikiUrlencode,
                                      querySerializer: QuerySerializer,
                                  ) {
                              Severity: Major
                              Found in client/data-bridge/src/data-access/RepoRouter.ts and 1 other location - About 1 hr to fix
                              view/lib/wikibase-tainted-ref/src/MWHookHandler.ts on lines 19..23

                              Duplicated Code

                              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                              Tuning

                              This issue has a mass of 62.

                              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                              Refactorings

                              Further Reading

                              Severity
                              Category
                              Status
                              Source
                              Language