wikimedia/mediawiki-extensions-Wikibase

View on GitHub

Showing 2,096 of 2,096 total issues

Method getChangedAspects has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getChangedAspects( EntityChange $change ) {
        $aspects = [];
        $diffAspects = $change->getCompactDiff();

        if ( $diffAspects->getSiteLinkChanges() !== [] ) {
Severity: Minor
Found in client/includes/Changes/AffectedPagesFinder.php - About 1 hr to fix

    Method generateOpHtml has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function generateOpHtml( array $path, DiffOp $op ) {
            if ( $op->isAtomic() ) {
                $localizedPath = $path;
    
                $html = $this->generateDiffHeaderHtml( implode( ' / ', $localizedPath ) );
    Severity: Minor
    Found in repo/includes/Diff/BasicDiffView.php - About 1 hr to fix

      Method generateNewId has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function generateNewId( IDatabase $database, $type, $retry = true ) {
              $database->startAtomic( __METHOD__ );
      
              $currentId = $database->newSelectQueryBuilder()
                  ->select( 'id_value' )
      Severity: Minor
      Found in repo/includes/Store/Sql/SqlIdGenerator.php - About 1 hr to fix

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

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

          Method validateTermSerialization has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function validateTermSerialization( $serialization, $languageCode ) {
                  $this->assertArray(
                      $serialization,
                      'An array was expected, but not found in term serialization for the language code ' . $languageCode
                  );

            Method processUnit has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function processUnit( $unit ) {
                    $this->output( "Processing $unit...\n" );
                    $query = <<<QUERY
            SELECT * WHERE {
            {
            Severity: Minor
            Found in repo/maintenance/addUnitConversions.php - About 1 hr to fix

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

                  public function validateAndDeserialize( UseCaseRequest $request ): DeserializedRequestAdapter {
                      $requestObjectId = spl_object_id( $request );
                      if ( array_key_exists( $requestObjectId, $this->validRequestResults ) ) {
                          return $this->validRequestResults[$requestObjectId];
                      }
              Severity: Minor
              Found in repo/rest-api/src/Infrastructure/ValidatingRequestDeserializer.php - About 1 hr to fix

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

                    public function execute( ReplaceStatementRequest $request ): ReplaceStatementResponse {
                        $deserializedRequest = $this->validator->validateAndDeserialize( $request );
                        $statementId = $deserializedRequest->getStatementId();
                        $statement = $deserializedRequest->getStatement();
                        $editMetadata = $deserializedRequest->getEditMetadata();

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

                      public function __construct( array $fields = [] ) {
                          Assert::parameter(
                              !array_diff( array_keys( $fields ), self::FIELD_NAMES ),
                              '$fields',
                              'must only contain the following keys: termType, termLanguage, termText'
                  Severity: Minor
                  Found in lib/includes/Store/TermIndexSearchCriteria.php - About 1 hr to fix

                    Method newFromEntityDiff has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function newFromEntityDiff( Diff $entityDiff ) {
                            $labelChanges = [];
                            $descriptionChanges = [];
                            $statementChanges = [];
                            $siteLinkChanges = [];

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

                          private function getLuaFunctionCallTracker(): LuaFunctionCallTracker {
                              if ( !$this->luaFunctionCallTracker ) {
                                  $mwServices = MediaWikiServices::getInstance();
                                  $settings = WikibaseClient::getSettings( $mwServices );
                      
                      
                      client/includes/DataAccess/Scribunto/WikibaseLibrary.php on lines 187..203

                      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 111.

                      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

                          private function getLuaFunctionCallTracker(): LuaFunctionCallTracker {
                              if ( !$this->luaFunctionCallTracker ) {
                                  $mwServices = MediaWikiServices::getInstance();
                                  $settings = WikibaseClient::getSettings( $mwServices );
                      
                      
                      Severity: Major
                      Found in client/includes/DataAccess/Scribunto/WikibaseLibrary.php and 1 other location - About 1 hr to fix
                      client/includes/DataAccess/Scribunto/WikibaseEntityLibrary.php on lines 114..130

                      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 111.

                      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

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

                              Article $article,
                              IContextSource $context,
                              PermissionManager $permissionManager,
                              RevisionLookup $revisionLookup,
                              TempUserCreator $tempUserCreator,
                      Severity: Major
                      Found in repo/includes/Actions/SubmitEntityAction.php - About 1 hr to fix

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

                                array $tags,
                                SpecialPageCopyrightView $specialPageCopyrightView,
                                EntityNamespaceLookup $entityNamespaceLookup,
                                SummaryFormatter $summaryFormatter,
                                EntityTitleLookup $entityTitleLookup,
                        Severity: Major
                        Found in repo/includes/Specials/SpecialNewProperty.php - About 1 hr to fix

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

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

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

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

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

                                      ApiMain $apiMain,
                                      string $moduleName,
                                      SiteLookup $siteLookup,
                                      IBufferingStatsdDataFactory $stats,
                                      ApiHelperFactory $apiHelperFactory,
                              Severity: Major
                              Found in repo/includes/Api/GetEntities.php - About 1 hr to fix

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

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

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

                                          InterwikiLookup $interwikiLookup,
                                          SpecialPageFactory $specialPageFactory,
                                          EntityExistenceChecker $entityExistenceChecker,
                                          EntityIdParser $entityIdParser,
                                          EntityLinkFormatterFactory $entityLinkFormatterFactory,
                                  Severity: Major
                                  Found in repo/includes/Hooks/HtmlPageLinkRendererEndHookHandler.php - About 1 hr to fix

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

                                            FingerprintChangeOpFactory $fingerprintChangeOpFactory,
                                            StatementChangeOpFactory $statementChangeOpFactory,
                                            SiteLinkChangeOpFactory $siteLinkChangeOpFactory,
                                            TermChangeOpSerializationValidator $termChangeOpSerializationValidator,
                                            SiteLinkBadgeChangeOpSerializationValidator $badgeChangeOpSerializationValidator,
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language