wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 994 of 1,238 total issues

Function getServers has a Cognitive Complexity of 14 (exceeds 5 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

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 prepareTranslationUnits has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    private function prepareTranslationUnits( TranslatablePage $page, ParserOutput $parserOutput ): array {
        $highest = (int)$this->messageGroupMetadata->get( $page->getMessageGroupId(), 'maxid' );

        $store = $this->translationUnitStoreFactory->getReader( $page->getPageIdentity() );
        $storedUnits = $store->getUnits();
Severity: Minor
Found in src/PageTranslation/TranslatablePageMarker.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 rebuild has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function rebuild( float $timestamp = null ): array {
        static $recursion = 0;

        if ( $recursion > 0 ) {
            $msg = __METHOD__ . ': trying to recurse - building the index first time?';
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 execute has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute( $par ) {
        $request = $this->getRequest();
        $user = $this->getUser();
        $this->addHelpLink( 'Help:Extension:Translate/Move_translatable_page' );
        $out = $this->getOutput();
Severity: Minor
Found in src/PageTranslation/MoveTranslatableBundleSpecialPage.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 applyFilter has a Cognitive Complexity of 14 (exceeds 5 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

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 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute( $par ) {
        $this->addHelpLink( 'Help:Deletion_and_undeletion' );

        $request = $this->getRequest();

Severity: Minor
Found in src/PageTranslation/DeleteTranslatableBundleSpecialPage.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 getNames has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function getNames(): array {
        $ttmServersIds = [];
        foreach ( $this->configs as $serviceId => $config ) {
            $type = $config['type'] ?? '';
            if ( $type === 'ttmserver' || $type === 'remote-ttmserver' ) {
Severity: Minor
Found in src/TtmServer/TtmServerFactory.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 getHopefullyValidConfigurations has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function getHopefullyValidConfigurations( string $data, ?callable $callback = null ): array {
        if ( !is_callable( $callback ) ) {
            $callback = static function ( $unused1, $unused2, $unused3 ) {
                /*noop*/
            };
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

Function flattenCLDRPlurals has a Cognitive Complexity of 14 (exceeds 5 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

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 loadMessagesFromCache has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    protected function loadMessagesFromCache( $groups ) {
        $messages = [];
        foreach ( $groups as $group ) {
            if ( $group instanceof self ) {
                $messages += $this->loadMessagesFromCache( $group->getGroups() );
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 doesKeyMatch has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    protected function doesKeyMatch( string $key, array $keyMatches ): bool {
        $normalizedKey = lcfirst( $key );
        foreach ( $keyMatches as $match ) {
            if ( is_string( $match ) ) {
                if ( lcfirst( $match ) === $normalizedKey ) {
Severity: Minor
Found in src/Validation/ValidationRunner.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 getTooltipSize has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function getTooltipSize(tooltip, model) {
    var ctx = tooltip._chart.ctx;

    var height = model.yPadding * 2; // Tooltip Padding
    var width = 0;
Severity: Minor
Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

    Function draw has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Method startSync has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function startSync( array $modificationJobs, array $renameJobs ): void {
              // We are adding an empty array for groups that have no jobs. This is mainly done to
              // avoid adding unnecessary checks. Remove those using array_filter
              $modificationGroupIds = array_keys( array_filter( $modificationJobs ) );
              $renameGroupIds = array_keys( array_filter( $renameJobs ) );
      Severity: Minor
      Found in src/Synchronization/ManageGroupsSpecialPage.php - About 1 hr to fix

        Method showRenames has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function showRenames(
                MessageGroup $group,
                MessageSourceChange $sourceChanges,
                OutputPage $out,
                string $language,
        Severity: Minor
        Found in src/Synchronization/ManageGroupsSpecialPage.php - About 1 hr to fix

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

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

            Method writeReal has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function writeReal( MessageCollection $collection ): string {
                    global $wgTranslateDocumentationLanguageCode;
            
                    $collection->filter( 'hastranslation', false );
                    if ( count( $collection ) === 0 ) {
            Severity: Minor
            Found in src/FileFormatSupport/AndroidXmlFormat.php - About 1 hr to fix

              Function getBackgroundPoint has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function getBackgroundPoint(vm, size, alignment, chart) {
                  // Background Position
                  var x = vm.x;
                  var y = vm.y;
              
              
              Severity: Minor
              Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

                Function updateElement has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    updateElement: function(arc, index, reset) {
                        var me = this;
                        var chart = me.chart;
                        var chartArea = chart.chartArea;
                        var opts = chart.options;
                Severity: Minor
                Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

                  Function search has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          search: function ( query ) {
                              var resultCount = 0,
                                  matcher = new RegExp( '(^|\\s|\\b)' + escapeRegex( query ), 'i' );
                  
                              this.$container.find( itemsClass[ this.mode ] ).each( function () {
                  Severity: Minor
                  Found in resources/js/ext.translate.messagetable.js - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language