wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

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

    private function showTitles( array $messageGroupsIds ): string {
        if ( count( $messageGroupsIds ) >= 100 ) {
            return $this->msg( 'tpt-manage-message-group-subscriptions-too-many' )->parse();
        }

Severity: Minor
Found in src/PageTranslation/ManageMessageGroupSubscriptionsSpecialPage.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

Avoid deeply nested control flow statements.
Open

                        if (isNaN(value.min) || isNaN(value.max) || meta.data[i].hidden || value.min < 0 || value.max < 0) {
                            continue;
                        }
Severity: Major
Found in resources/lib/Chart.js/Chart.js - About 45 mins to fix

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

        private function handlePriorityLanguages(
            TranslatablePage $page,
            TranslatablePageSettings $pageSettings,
            UserIdentity $user
        ): void {
    Severity: Minor
    Found in src/PageTranslation/TranslatablePageMarker.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 deleteAsynchronously has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            Title $title,
            bool $isTranslation,
            UserIdentity $user,
            array $subpageList,
            bool $deleteSubpages,
    Severity: Minor
    Found in src/PageTranslation/TranslatableBundleDeleter.php - About 45 mins to fix

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

              ApiMain $main,
              string $moduleName,
              RevisionLookup $revisionLookup,
              TitleFormatter $titleFormatter,
              ILoadBalancer $loadBalancer,
      Severity: Minor
      Found in src/TranslatorInterface/ReviewTranslationActionApi.php - About 45 mins to fix

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

            public function getPages(): array {
                $namespace = $this->namespace;
                if ( isset( $this->pages ) ) {
                    return $this->pages;
                }
        Severity: Minor
        Found in src/MessageLoading/MessageDefinitions.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 addTranstagAfterSave has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                WikiPage $wikiPage,
                UserIdentity $userIdentity,
                string $summary,
                int $flags,
                RevisionRecord $revisionRecord,
        Severity: Minor
        Found in src/PageTranslation/Hooks.php - About 45 mins to fix

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

                  Title $source,
                  Title $target,
                  bool $moveSubPages,
                  bool $fetchTranslatableSubpages,
                  bool $moveTalkPages,
          Severity: Minor
          Found in src/PageTranslation/TranslatableBundleMover.php - About 45 mins to fix

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

                private function move(
                    TranslatableBundle $sourceBundle,
                    User $performer,
                    array $pagesToMove,
                    array $pagesToRedirect,
            Severity: Minor
            Found in src/PageTranslation/TranslatableBundleMover.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

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

                public static function disallowLangTranslations(
                    Title $title,
                    User $user,
                    string $action,
                    &$result
            Severity: Minor
            Found in src/TranslatorInterface/TranslateEditAddons.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 onDeleteTranslationUnit has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    WikiPage $unit,
                    User $user,
                    $reason,
                    $id,
                    $content,
            Severity: Minor
            Found in src/PageTranslation/Hooks.php - About 45 mins to fix

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

                      ObjectFactory $objectFactory,
                      PermissionManager $permissionManager,
                      TranslatableBundleMover $bundleMover,
                      TranslatableBundleFactory $bundleFactory,
                      FormatterFactory $formatterFactory,
              Severity: Minor
              Found in src/PageTranslation/MoveTranslatableBundleSpecialPage.php - About 45 mins to fix

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

                    public function parseUnit( string $content ): TranslationUnit {
                        $re = '~<!--T:(.*?)-->~';
                        $matches = [];
                        $count = preg_match_all( $re, $content, $matches, PREG_SET_ORDER );
                
                
                Severity: Minor
                Found in src/PageTranslation/TranslatablePageParser.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 onSaveComplete has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        WikiPage $wikiPage,
                        UserIdentity $userIdentity,
                        string $summary,
                        int $flags,
                        RevisionRecord $revisionRecord,
                Severity: Minor
                Found in src/TranslatorInterface/TranslateEditAddons.php - About 45 mins to fix

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

                          ApiQuery $query,
                          string $moduleName,
                          ConfigHelper $configHelper,
                          LanguageNameUtils $languageNameUtils,
                          ILoadBalancer $loadBalancer,
                  Severity: Minor
                  Found in src/MessageLoading/QueryMessageCollectionActionApi.php - About 45 mins to fix

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

                        public function getArrayDiff( array $old, array $new ): array {
                            $values = [];
                            $record = static function ( $groups ) use ( &$values ) {
                                foreach ( $groups as $group ) {
                                    $values[$group] = true;
                    Severity: Minor
                    Found in src/MessageLoading/MessageIndex.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

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

                        private static function getTranslationRestrictions( MessageHandle $handle, $groupId ) {
                            global $wgTranslateDocumentationLanguageCode;
                    
                            // Allow adding message documentation even when translation is restricted
                            if ( $handle->getCode() === $wgTranslateDocumentationLanguageCode ) {
                    Severity: Minor
                    Found in src/PageTranslation/Hooks.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 move has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            TranslatableBundle $sourceBundle,
                            User $performer,
                            array $pagesToMove,
                            array $pagesToRedirect,
                            string $reason,
                    Severity: Minor
                    Found in src/PageTranslation/TranslatableBundleMover.php - About 45 mins to fix

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

                          public function getDocuments(): array {
                              $documents = [];
                              $offset = $this->params['offset'];
                              $limit = $this->params['limit'];
                      
                      
                      Severity: Minor
                      Found in src/TtmServer/CrossLanguageTranslationSearchQuery.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 handleModificationsSubmit has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              MessageGroup $group,
                              MessageSourceChange $sourceChanges,
                              WebRequest $req,
                              string $language,
                              array &$postponed,
                      Severity: Minor
                      Found in src/Synchronization/ManageGroupsSpecialPage.php - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language