wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 994 of 1,238 total issues

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

        TranslatablePage $page,
        ParserOutput $parserOutput,
        array $units,
        array $deletedUnits,
        bool $firstMark,
Severity: Minor
Found in src/PageTranslation/TranslatablePageMarkOperation.php - About 45 mins to fix

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

        public static function getRenderJobs( TranslatablePage $page, bool $nonPrioritizedJobs = false ): array {
            $documentationLanguageCode = MediaWikiServices::getInstance()
                ->getMainConfig()
                ->get( 'TranslateDocumentationLanguageCode' );
    
    
    Severity: Minor
    Found in src/PageTranslation/UpdateTranslatablePageJob.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 (value.min !== 0) {
                                me.minNotZero = Math.min(value.min, me.minNotZero);
                            }
    Severity: Major
    Found in resources/lib/Chart.js/Chart.js - About 45 mins to fix

      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

                        Severity
                        Category
                        Status
                        Source
                        Language