wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 994 of 1,238 total issues

Function generateTicks$1 has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function generateTicks$1(generationOptions, dataRange) {
    var ticks = [];

    var tickVal = valueOrDefault$b(generationOptions.min, Math.pow(10, Math.floor(log10(dataRange.min))));

Severity: Minor
Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

    Function buildOrUpdateControllers has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        buildOrUpdateControllers: function() {
            var me = this;
            var newControllers = [];
            var datasets = me.data.datasets;
            var i, ilen;
    Severity: Minor
    Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

      Method getServers has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function getServers(
              bool $isDryRun,
              bool $shouldReindex,
              ?string $ttmServerId = null
          ): array {
      Severity: Minor
      Found in scripts/ttmserver-export.php - About 1 hr to fix

        Function afterDatasetsUpdate has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            afterDatasetsUpdate: function(chart, options) {
                var count = (chart.data.datasets || []).length;
                var propagate = options.propagate;
                var sources = [];
                var meta, i, el, source;
        Severity: Minor
        Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

          Method applyFilter has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function applyFilter( string $filter, bool $condition, ?int $value ): void {
                  $keys = $this->keys;
                  if ( $filter === 'fuzzy' ) {
                      $keys = $this->filterFuzzy( $keys, $condition );
                  } elseif ( $filter === 'hastranslation' ) {
          Severity: Minor
          Found in src/MessageLoading/MessageCollection.php - About 1 hr to fix

            Method tabify has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function tabify( Skin $skin, array &$tabs ): void {
                    $title = $skin->getTitle();
                    if ( !$title->isSpecialPage() ) {
                        return;
                    }
            Severity: Minor
            Found in src/Synchronization/ManageGroupsSpecialPage.php - About 1 hr to fix

              Method loadTranslationData has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static function loadTranslationData( IDatabase $db, MessageHandle $handle ): array {
                      $revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
                      $conditions = [];
              
                      // The list of pages we want to select, and their latest versions
              Severity: Minor
              Found in src/TranslatorInterface/Aid/TranslationAidDataProvider.php - About 1 hr to fix

                Method getMessageParameters has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getMessageParameters(): array {
                        $params = parent::getMessageParameters();
                
                        $type = $this->entry->getFullType();
                
                
                Severity: Minor
                Found in src/LogFormatter.php - About 1 hr to fix

                  Method getServersToUpdate has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function getServersToUpdate( ?string $requestedServiceId ): array {
                          $ttmServerFactory = Services::getInstance()->getTtmServerFactory();
                          if ( $requestedServiceId ) {
                              if ( !$ttmServerFactory->has( $requestedServiceId ) ) {
                                  $this->logger->warning(
                  Severity: Minor
                  Found in src/TtmServer/TtmServerMessageUpdateJob.php - About 1 hr to fix

                    Method subGroups has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function subGroups(
                            AggregateMessageGroup $parent,
                            array &$childIds = [],
                            string $fname = 'caller'
                        ): array {
                    Severity: Minor
                    Found in src/MessageGroupProcessing/MessageGroups.php - About 1 hr to fix

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

                          public function __construct() {
                              parent::__construct();
                              $this->addDescription(
                                  'Export a translatable bundle into a file that can then be imported ' .
                                  'into another wiki using the importTranslatableBundle.php script'

                        Method inAllLanguages has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function inAllLanguages(): array {
                                $dbr = $this->loadBalancer->getConnection( DB_REPLICA, 'vslow' );
                        
                                $res = $dbr->newSelectQueryBuilder()
                                    ->select( [
                        Severity: Minor
                        Found in src/Statistics/TranslatorActivityQuery.php - About 1 hr to fix

                          Method getContents has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static function getContents( $titles, int $namespace ): array {
                                  $mwServices = MediaWikiServices::getInstance();
                                  $dbr = $mwServices->getConnectionProvider()->getReplicaDatabase();
                                  $revStore = $mwServices->getRevisionStore();
                                  $titleContents = [];
                          Severity: Minor
                          Found in src/Utilities/Utilities.php - About 1 hr to fix

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

                                public function execute( $parameters ): void {
                                    $this->setHeaders();
                                    $this->addHelpLink( 'Help:Extension:Translate/Page translation administration' );
                            
                                    $out = $this->getOutput();
                            Severity: Minor
                            Found in src/MessageGroupProcessing/AggregateGroupsSpecialPage.php - About 1 hr to fix

                              Function addLanguageLinks has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public static function addLanguageLinks( Title $title, array &$languageLinks ) {
                                      global $wgPageTranslationLanguageList;
                              
                                      if ( $wgPageTranslationLanguageList === 'tag-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 parse has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function parse( string $text ): ParserOutput {
                                      $nowiki = [];
                                      $text = $this->armourNowiki( $nowiki, $text );
                              
                                      $sections = [];
                              Severity: Minor
                              Found in src/PageTranslation/TranslatablePageParser.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 getAuthors has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function getAuthors(): array {
                                      $this->loadTranslations();
                              
                                      $authors = array_flip( $this->authors );
                              
                              
                              Severity: Minor
                              Found in src/MessageLoading/MessageCollection.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 getPagesToMove has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function getPagesToMove(
                                      Title $source,
                                      Title $target,
                                      bool $moveSubPages,
                                      bool $fetchTranslatableSubpages,
                              Severity: Minor
                              Found in src/PageTranslation/TranslatableBundleMover.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 doCreate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function doCreate(): void {
                                      $params = $this->extractRequestParams();
                              
                                      // Do validations
                                      foreach ( explode( '|', 'username|password|email' ) as $field ) {
                              Severity: Minor
                              Found in src/TranslatorSandbox/TranslatorSandboxActionApi.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 parseDocuments has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function parseDocuments( array $documents ): array {
                                      $groups = [];
                                      $template = [];
                              
                                      foreach ( $documents as $document ) {
                              Severity: Minor
                              Found in src/MessageGroupConfiguration/MessageGroupConfigurationParser.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