wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 994 of 1,238 total issues

Function onMovePageTranslationUnits has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public static function onMovePageTranslationUnits(
        LinkTarget $oldLinkTarget,
        LinkTarget $newLinkTarget,
        UserIdentity $userIdentity,
        int $oldid,
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 fetchTranslatableTemplateAndTitle has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public static function fetchTranslatableTemplateAndTitle(
        ?LinkTarget $contextLink,
        ?LinkTarget $templateLink,
        bool &$skip,
        ?RevisionRecord &$revRecord
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 filterChanged has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    private function filterChanged( array $keys, bool $condition ): array {
        $this->loadData( $keys );

        $origKeys = [];
        if ( !$condition ) {
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 execute has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute(): void {
        $params = $this->extractRequestParams();

        // The user we are operating on, not necessarily the user making the request
        $user = $this->getUser();
Severity: Minor
Found in src/TranslatorSandbox/TranslationStashActionApi.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 getDefinitions has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function getDefinitions() {
        global $wgTranslateSandboxLimit;

        // This will contain the list of messages shown to the user
        $list = [];
Severity: Minor
Found in messagegroups/SandboxMessageGroup.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 getGroups has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function getGroups(): array {
        if ( $this->groups === null ) {
            $groups = [];
            $ids = (array)$this->conf['GROUPS'];
            $ids = MessageGroups::expandWildcards( $ids );
Severity: Minor
Found in messagegroups/AggregateMessageGroup.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 updateBezierControlPoints has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    updateBezierControlPoints: function() {
        var me = this;
        var chart = me.chart;
        var meta = me.getMeta();
        var lineModel = meta.dataset._model;
Severity: Minor
Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

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

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

      Method parse has 47 lines of code (exceeds 25 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

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

            public function execute( $par ) {
                $this->setHeaders();
        
                $out = $this->getOutput();
                $out->addModuleStyles( 'ext.translate.specialpages.styles' );
        Severity: Minor
        Found in src/Synchronization/ManageGroupsSpecialPage.php - About 1 hr to fix

          Method searchStaticMessageGroups has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function searchStaticMessageGroups( string $query, int $maxResults, array $types = [] ): array {
                  $cache = $this->cache;
                  // None of the static groups currently use language-dependent labels. This
                  // may need revisiting later and splitting the cache by language.
                  $key = $cache->makeKey( 'Translate', 'EntitySearch', 'static-groups', '-v2' );
          Severity: Minor
          Found in src/TranslatorInterface/EntitySearch.php - About 1 hr to fix

            Method checkNonSourceAdditionsForRename has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function checkNonSourceAdditionsForRename(
                    MessageSourceChange $changes,
                    string $sourceLanguage,
                    string $targetLanguage,
                    MessageCollection $wiki,
            Severity: Minor
            Found in src/Synchronization/ExternalMessageSourceStateComparator.php - About 1 hr to fix

              Method queueUpdates has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static function queueUpdates( int $flags ): void {
                      $mwInstance = MediaWikiServices::getInstance();
                      if ( self::$updates === [] || $mwInstance->getReadOnlyMode()->isReadOnly() ) {
                          return;
                      }
              Severity: Minor
              Found in src/Statistics/MessageGroupStats.php - About 1 hr to fix

                Method get has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function get(
                        array $stats,
                        MessageGroup $group,
                        bool $noComplete,
                        bool $noEmpty
                Severity: Minor
                Found in src/Statistics/MessageGroupStatsTable.php - About 1 hr to fix

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

                          IConnectionProvider $dbProvider,
                          JobQueueGroup $jobQueueGroup,
                          LinkRenderer $linkRenderer,
                          MessageGroups $messageGroups,
                          MessageIndex $messageIndex,
                  Severity: Major
                  Found in src/PageTranslation/TranslatablePageMarker.php - About 1 hr to fix

                    Function calculateBarValuePixels has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        calculateBarValuePixels: function(datasetIndex, index, options) {
                            var me = this;
                            var chart = me.chart;
                            var scale = me._getValueScale();
                            var isHorizontal = scale.isHorizontal();
                    Severity: Minor
                    Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

                      Function addProofread has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              addProofread: function ( message ) {
                                  var $message = $( '<div>' )
                                      .addClass( 'row tux-message tux-message-proofread' );
                      
                                  this.$container.append( $message );
                      Severity: Minor
                      Found in resources/js/ext.translate.messagetable.js - About 1 hr to fix

                        Function display has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                display: function () {
                                    var instance = this;
                        
                                    instance.$container.empty();
                                    if ( !instance.states ) {
                        Severity: Minor
                        Found in resources/js/ext.translate.workflowselector.js - About 1 hr to fix

                          Function update has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              update: function(chart, width, height) {
                                  if (!chart) {
                                      return;
                                  }
                          
                          
                          Severity: Minor
                          Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

                            Method priorityLanguagesForm has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                private function priorityLanguagesForm( TranslatablePage $page ): void {
                                    $groupId = $page->getMessageGroupId();
                                    $interfaceLanguage = $this->getLanguage()->getCode();
                                    $storedLanguages = (string)$this->messageGroupMetadata->get( $groupId, 'prioritylangs' );
                                    $default = $storedLanguages !== '' ? explode( ',', $storedLanguages ) : [];
                            Severity: Minor
                            Found in src/PageTranslation/PageTranslationSpecialPage.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language