wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 994 of 1,238 total issues

Method formatRename has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function formatRename(
        MessageGroup $group,
        array $addedMsg,
        array $deletedMsg,
        string $language,
Severity: Major
Found in src/Synchronization/ManageGroupsSpecialPage.php - About 2 hrs to fix

    Method messageSelector has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function messageSelector(): string {
            $nonDefaults = $this->opts->getChangedValues();
            $output = Html::openElement( 'div', [ 'class' => 'row tux-messagetable-header' ] );
            $output .= Html::openElement( 'div', [ 'class' => 'twelve columns' ] );
            $output .= Html::openElement( 'ul', [ 'class' => 'row tux-message-selector' ] );
    Severity: Major
    Found in src/TtmServer/SearchTranslationsSpecialPage.php - About 2 hrs to fix

      Function switchMode has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              switchMode: function ( mode ) {
                  var messageTable = this,
                      filter = this.settings.filter,
                      userId = mw.config.get( 'wgUserId' );
      
      
      Severity: Major
      Found in resources/js/ext.translate.messagetable.js - About 2 hrs to fix

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

            public function execute() {
                $handle = fopen( $this->getArg( 0 ), 'r' );
                // remove heading
                // @phan-suppress-next-line PhanPluginUseReturnValueInternalKnown
                fgets( $handle );
        Severity: Major
        Found in scripts/translator-stats-process.php - About 2 hrs to fix

          Method renderTagPage has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function renderTagPage( $wikitextParser, &$text, $state ): void {
                  if ( $text === null ) {
                      // SMW is unhelpfully sending null text if the source contains section tags. Do not explode.
                      return;
                  }
          Severity: Major
          Found in src/PageTranslation/Hooks.php - About 2 hrs to fix

            Method getData has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getData(): array {
                    $db = Utilities::getSafeReadDB();
            
                    $revTagStore = Services::getInstance()->getRevTagStore();
            
            
            Severity: Major
            Found in src/TranslatorInterface/Aid/UpdatedDefinitionAid.php - About 2 hrs to fix

              Method makeUserList has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function makeUserList( array $userStats ): void {
                      $day = 60 * 60 * 24;
              
                      // Scale of the activity colors, anything
                      // longer than this is just inactive
              Severity: Major
              Found in src/Statistics/ActiveLanguagesSpecialPage.php - About 2 hrs to fix

                Method getMetadata has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getMetadata(): MessageBundleMetadata {
                        if ( $this->metadata !== null ) {
                            return $this->metadata;
                        }
                
                
                Severity: Major
                Found in src/MessageBundleTranslation/MessageBundleContent.php - About 2 hrs to fix

                  Function createMessageTools has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          createMessageTools: function () {
                              var $editItem = this.createMessageToolsItem(
                                  'message-tools-edit',
                                  {
                                      title: this.message.title,
                  Severity: Major
                  Found in resources/js/ext.translate.editor.js - About 2 hrs to fix

                    Method doFuzzy has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function doFuzzy(
                            Title $title,
                            string $message,
                            string $comment,
                            ?User $user
                    Severity: Major
                    Found in src/Synchronization/MessageWebImporter.php - About 2 hrs to fix

                      Method doGettextHeader has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function doGettextHeader( MessageCollection $collection, array $template ): string {
                              global $wgSitename;
                      
                              $code = $collection->code;
                              $name = Utilities::getLanguageName( $code );
                      Severity: Major
                      Found in src/FileFormatSupport/GettextFormat.php - About 2 hrs to fix

                        Function onSaveComplete has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function onSaveComplete(
                                WikiPage $wikiPage,
                                UserIdentity $userIdentity,
                                string $summary,
                                int $flags,
                        Severity: Minor
                        Found in src/TranslatorInterface/TranslateEditAddons.php - About 2 hrs 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 run has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function run(): bool {
                                $this->logJobStart();
                                $mwServices = MediaWikiServices::getInstance();
                                // We may be doing double wait here if this job was spawned by TranslationUpdateJob
                                $lb = $mwServices->getDBLoadBalancerFactory();
                        Severity: Minor
                        Found in src/PageTranslation/RenderTranslationPageJob.php - About 2 hrs 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 showRenames has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function showRenames(
                                MessageGroup $group,
                                MessageSourceChange $sourceChanges,
                                OutputPage $out,
                                string $language,
                        Severity: Minor
                        Found in src/Synchronization/ManageGroupsSpecialPage.php - About 2 hrs 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 getData has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function getData(): array {
                                // We need to get the primary group to get the correct file
                                // So $group can be different from $this->group
                                $group = $this->handle->getGroup();
                                if ( !$group instanceof FileBasedMessageGroup ) {
                        Severity: Minor
                        Found in src/TranslatorInterface/Aid/GettextDocumentationAid.php - About 2 hrs 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 unflattenCLDRPlurals has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function unflattenCLDRPlurals( string $key, string $message ) {
                                // Quick escape.
                                if ( !str_contains( $message, '{{PLURAL' ) ) {
                                    return false;
                                }
                        Severity: Minor
                        Found in src/MessageProcessing/ArrayFlattener.php - About 2 hrs 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 getMetadata has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function getMetadata(): MessageBundleMetadata {
                                if ( $this->metadata !== null ) {
                                    return $this->metadata;
                                }
                        
                        
                        Severity: Minor
                        Found in src/MessageBundleTranslation/MessageBundleContent.php - About 2 hrs 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 findMessage has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function findMessage( $language, $key, $possibleStates = [], &$modificationType = null ) {
                                $allChanges = [];
                                $allChanges[self::ADDITION] = $this->getAdditions( $language );
                                $allChanges[self::DELETION] = $this->getDeletions( $language );
                                $allChanges[self::CHANGE] = $this->getChanges( $language );
                        Severity: Minor
                        Found in src/MessageSync/MessageSourceChange.php - About 2 hrs 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 handleRename has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function handleRename(
                                MessageGroup $group,
                                MessageSourceChange $sourceChanges,
                                string $msgKey,
                                string $keyToRename,
                        Severity: Minor
                        Found in src/MessageGroupProcessing/ManageMessageGroupsActionApi.php - About 2 hrs 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 importData has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function importData(
                                array $messagesWithTranslations,
                                Authority $authority,
                                string $comment,
                                ?callable $progressReporter = null
                        Severity: Minor
                        Found in src/MessageGroupProcessing/CsvTranslationImporter.php - About 2 hrs 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