wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 994 of 1,238 total issues

Function _drawLabels has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _drawLabels: function() {
        var me = this;
        var ctx = me.ctx;
        var opts = me.options;
        var tickOpts = opts.ticks;
Severity: Minor
Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

    Function render has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        render: function(config) {
            var me = this;
    
            if (!config || typeof config !== 'object') {
                // backwards compatibility
    Severity: Minor
    Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

      Method move has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function move(
              TranslatableBundle $sourceBundle,
              User $performer,
              array $pagesToMove,
              array $pagesToRedirect,
      Severity: Minor
      Found in src/PageTranslation/TranslatableBundleMover.php - About 1 hr to fix

        Method handlePriorityLanguages has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function handlePriorityLanguages(
                TranslatablePage $page,
                TranslatablePageSettings $pageSettings,
                UserIdentity $user
            ): void {
        Severity: Minor
        Found in src/PageTranslation/TranslatablePageMarker.php - About 1 hr to fix

          Method deleteUser has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function deleteUser( User $user, string $force = '' ): void {
                  $uid = $user->getId();
                  $actorId = $user->getActorId();
          
                  if ( $force !== 'force' && !self::isSandboxed( $user ) ) {
          Severity: Minor
          Found in src/TranslatorSandbox/TranslateSandbox.php - About 1 hr to fix

            Method getWritable has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getWritable(): array {
                    $writableServers = $readOnlyServers = [];
                    $ttmServerIds = $this->getNames();
            
                    foreach ( $ttmServerIds as $serverId ) {
            Severity: Minor
            Found in src/TtmServer/TtmServerFactory.php - About 1 hr to fix

              Method createSearch has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function createSearch( string $queryString, array $opts, array $highlight ): Search {
                      $query = new Query();
              
                      [ $searchQuery, $highlights ] = $this->parseQueryString( $queryString, $opts );
                      $query->setQuery( $searchQuery );
              Severity: Minor
              Found in src/TtmServer/ElasticSearchTtmServer.php - About 1 hr to fix

                Method addUser has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function addUser( string $name, string $email, string $password ): User {
                        $user = $this->userFactory->newFromName( $name, UserFactory::RIGOR_CREATABLE );
                
                        if ( !$user ) {
                            throw new InvalidArgumentException( 'Invalid user name' );
                Severity: Minor
                Found in src/TranslatorSandbox/TranslateSandbox.php - About 1 hr to fix

                  Method getHtmlForGroupErrors has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function getHtmlForGroupErrors(
                          GroupSynchronizationResponse $groupErrorResponse,
                          Language $language,
                          string $wrapperClass
                      ): string {
                  Severity: Minor
                  Found in src/Synchronization/DisplayGroupSynchronizationInfo.php - About 1 hr to fix

                    Method save has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function save(
                            Title $pageTitle,
                            RevisionRecord $revisionRecord,
                            MessageBundleContent $content
                        ): void {
                    Severity: Minor
                    Found in src/MessageBundleTranslation/MessageBundleStore.php - About 1 hr to fix

                      Method getMessages has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getMessages(): array {
                              if ( $this->messages !== null ) {
                                  return $this->messages;
                              }
                      
                      
                      Severity: Minor
                      Found in src/MessageBundleTranslation/MessageBundleContent.php - About 1 hr to fix

                        Method getTable has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function getTable( array $stats ): string {
                                $table = $this->table;
                                $out = '';
                        
                                // This avoids a database query per translatable page, which would be caused by
                        Severity: Minor
                        Found in src/Statistics/LanguageStatsSpecialPage.php - About 1 hr to fix

                          Method getGroupLoaders has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function getGroupLoaders(): array {
                                  if ( $this->groupLoaders !== null ) {
                                      return $this->groupLoaders;
                                  }
                          
                          
                          Severity: Minor
                          Found in src/MessageGroupProcessing/MessageGroups.php - About 1 hr to fix

                            Method import has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function import(
                                    string $importFilePath,
                                    string $interwikiPrefix,
                                    bool $assignKnownUsers,
                                    UserIdentity $user,
                            Severity: Minor
                            Found in src/MessageGroupProcessing/TranslatableBundleImporter.php - About 1 hr to fix

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

                                  public function execute() {
                                      $user = $this->getUser();
                                      $requestParams = $this->extractRequestParams();
                              
                                      $group = MessageGroups::getGroup( $requestParams['group'] );
                              Severity: Minor
                              Found in src/MessageGroupProcessing/GroupReviewActionApi.php - About 1 hr to fix

                                Function languages has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public static function languages( $data, $params, $parser ) {
                                        global $wgPageTranslationLanguageList;
                                
                                        if ( $wgPageTranslationLanguageList === 'sidebar-only' ) {
                                            return '';
                                Severity: Minor
                                Found in src/PageTranslation/Hooks.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 execute has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function execute(): void {
                                        $params = $this->extractRequestParams();
                                
                                        $title = Title::newFromText( $params['title'] );
                                        if ( !$title ) {
                                Severity: Minor
                                Found in src/MessageLoading/QueryMessageTranslationsActionApi.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 getLanguageExportActions has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    private function getLanguageExportActions(
                                        string $groupId,
                                        array $requestedLanguages,
                                        array $alwaysExportLanguages,
                                        int $exportThreshold = 0,
                                Severity: Minor
                                Found in src/Synchronization/ExportTranslationsMaintenanceScript.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 processGroups has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    protected function processGroups( array $groups ): array {
                                        $fixedGroups = [];
                                        foreach ( $groups as $g ) {
                                            $name = $g['name'];
                                            $sanitizedName = preg_replace( '/\s+/', '', strtolower( $name ) );
                                Severity: Minor
                                Found in src/MessageGroupConfiguration/PremadeIntuitionTextdomains.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 getTranslationsWithFallback has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    private function getTranslationsWithFallback(
                                        MessageBundle $messageBundle,
                                        string $languageCode,
                                        bool $skipFallbacks
                                    ): array {
                                Severity: Minor
                                Found in src/MessageBundleTranslation/MessageBundleTranslationLoader.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

                                Severity
                                Category
                                Status
                                Source
                                Language