wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

Function handleTickRangeOptions has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

        public function execute() {
            $target = rtrim( $this->getOption( 'target' ), '/' );
            $sourceLanguage = $this->getOption( 'source-language' );
            $targetLanguage = $this->getOption( 'target-language' );
    
    
    Severity: Minor
    Found in scripts/export-rename-language.php - About 1 hr to fix

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

          public function execute() {
              global $wgTranslateTranslationServices;
      
              $name = $this->getOption( 'service' );
      
      
      Severity: Minor
      Found in scripts/test-mt.php - About 1 hr to fix

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

            public function __construct( Title $source, Title $target ) {
                $this->map[$source->getNamespace()] = [
                    $target->getNamespace(),
                    $source->getText(),
                    $target->getText(),
        Severity: Minor
        Found in src/PageTranslation/PageTitleRenamer.php - About 1 hr to fix

          Method disallowLangTranslations has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function disallowLangTranslations(
                  Title $title,
                  User $user,
                  string $action,
                  &$result
          Severity: Minor
          Found in src/TranslatorInterface/TranslateEditAddons.php - About 1 hr to fix

            Method doPairs has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function doPairs(): array {
                    if ( !isset( $this->config['key'] ) ) {
                        throw new TranslationWebServiceConfigurationException( 'key is not set' );
                    }
            
            
            Severity: Minor
            Found in src/WebService/MicrosoftWebService.php - About 1 hr to fix

              Method isExcluded has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function isExcluded( string $groupId, string $code ): bool {
                      if ( $this->priorityCache === null ) {
                          // TODO: Ideally, this should use the injected ILoadBalancer to make it mockable.
                          $db = Utilities::getSafeReadDB();
                          $res = $db->newSelectQueryBuilder()
              Severity: Minor
              Found in src/MessageProcessing/MessageGroupMetadata.php - About 1 hr to fix

                Method flattenCLDRPlurals has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function flattenCLDRPlurals( array $messages ) {
                        $hasNonPluralKeys = false;
                        $pluralKeys = [];
                        foreach ( $messages as $key => $value ) {
                            if ( is_array( $value ) ) {
                Severity: Minor
                Found in src/MessageProcessing/ArrayFlattener.php - About 1 hr to fix

                  Method validate has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function validate( Title $pageTitle, MessageBundleContent $content ): void {
                          $content->validate();
                          // Verify that the language code is valid
                          $metadata = $content->getMetadata();
                          $sourceLanguageCode = $metadata->getSourceLanguageCode();
                  Severity: Minor
                  Found in src/MessageBundleTranslation/MessageBundleStore.php - About 1 hr to fix

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

                        public function execute() {
                            $this->pageImportCount = 0;
                            $importFilePath = $this->getPathOfFileToImport();
                            $importUser = $this->getImportUser();
                            $comment = $this->getOption( 'comment' );

                      Method createQueryBuilder has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function createQueryBuilder( IReadableDatabase $database, string $caller ): SelectQueryBuilder {
                              global $wgTranslateMessageNamespaces;
                      
                              $fields = [ 'rc_timestamp' ];
                      
                      
                      Severity: Minor
                      Found in src/Statistics/TranslatePerLanguageStats.php - About 1 hr to fix

                        Method getDefinitions has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function getDefinitions() {
                                if ( !$this->language ) {
                                        throw new BadMethodCallException( 'Language not set' );
                                }
                        
                        
                        Severity: Minor
                        Found in messagegroups/RecentMessageGroup.php - About 1 hr to fix

                          Method getIssues has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function getIssues( Message $message, string $targetLanguage ): ValidationIssues {
                                  $issues = new ValidationIssues();
                          
                                  preg_match_all( $this->validationRegex, $message->definition(), $definitionMatch );
                                  preg_match_all( $this->validationRegex, $message->translation(), $translationMatch );
                          Severity: Minor
                          Found in src/Validation/Validators/InsertableRegexValidator.php - About 1 hr to fix

                            Function EntitySelectorWidget has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                            var EntitySelectorWidget = function ( config ) {
                                // Parent constructor
                                OO.ui.TextInputWidget.call( this, {
                                    classes: [ 'tes-entity-selector' ],
                                    placeholder: mw.msg( 'translate-tes-type-to-search' ),
                            Severity: Minor
                            Found in resources/src/ext.translate.entity.selector/index.js - 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 actionLinks has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                                private function actionLinks( array $page, string $type ): string {
                                    // Performance optimization to avoid calling $this->msg in a loop
                                    static $messageCache = null;
                                    if ( $messageCache === null ) {
                                        $messageCache = [
                            Severity: Minor
                            Found in src/PageTranslation/PageTranslationSpecialPage.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 getTextForRendering has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function getTextForRendering(
                                    ?Message $msg,
                                    Language $sourceLanguage,
                                    Language $targetLanguage,
                                    bool $wrapUntranslated,
                            Severity: Minor
                            Found in src/PageTranslation/TranslationUnit.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 sourcePageHeader has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                                private static function sourcePageHeader( IContextSource $context ) {
                                    $linker = MediaWikiServices::getInstance()->getLinkRenderer();
                            
                                    $language = $context->getLanguage();
                                    $title = $context->getTitle();
                            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 tabify has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public static function tabify( Skin $skin, array &$tabs ): bool {
                                    $title = $skin->getTitle();
                                    if ( !$title->isSpecialPage() ) {
                                        return true;
                                    }
                            Severity: Minor
                            Found in src/TranslatorInterface/TranslateSpecialPage.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 checkAndAdd has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                                protected function checkAndAdd( array &$hugeArray, MessageGroup $g, bool $ignore = false ): void {
                                    $keys = $g->getKeys();
                                    $id = $g->getId();
                                    $namespace = $g->getNamespace();
                            
                            
                            Severity: Minor
                            Found in src/MessageLoading/MessageIndex.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 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                                protected function processGroups( array $groups ): array {
                                    $fixedGroups = [];
                                    foreach ( $groups as $g ) {
                                        $name = $g['name'];
                            
                            
                            Severity: Minor
                            Found in src/MessageGroupConfiguration/PremadeMediaWikiExtensionGroups.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