wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 994 of 1,238 total issues

Method identifyDifferences has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function identifyDifferences(
        array $translatableBundles,
        array $translatableBundleStatuses
    ): array {
        $result = [
Severity: Minor
Found in src/Diagnostics/SyncTranslatableBundleStatusMaintenanceScript.php - About 1 hr to fix

    Function top has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        top: function ( position, data ) {
            var within = data.within,
                withinOffset = within.offset.top + within.scrollTop,
                outerHeight = within.height,
                offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
    Severity: Minor
    Found in resources/src/ext.translate.groupselector/ui.position.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 getPageList has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        private function getPageList( array $pages, string $type ): string {
            $items = [];
            $tagsTextCache = [];
    
            $tagDiscouraged = $this->msg( 'tpt-tag-discouraged' )->escaped();
    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 execute has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        public function execute() {
            $mwLanguages = $this->loadMediaWiki();
            $gtLanguages = $this->loadGettext();
            $clLanguages = $this->loadCLDR();
    
    
    Severity: Minor
    Found in scripts/plural-comparison.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 makeGroupFacetRows has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        private function makeGroupFacetRows(
            array $groups,
            array $counts,
            int $level = 0,
            string $pathString = ''
    Severity: Minor
    Found in src/TtmServer/SearchTranslationsSpecialPage.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 getMessageGroups has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        private function getMessageGroups(
            string $groupPattern,
            string $excludePattern,
            bool $forOffline
        ): array {
    Severity: Minor
    Found in src/Synchronization/ExportTranslationsMaintenanceScript.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 validateMessage has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function validateMessage(
            IContextSource $context,
            Content $content,
            Status $status,
            string $summary,
    Severity: Minor
    Found in src/HookHandler.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 13 (exceeds 5 allowed). Consider refactoring.
    Open

        public function execute( $parameters ) {
            $this->setHeaders();
    
            // Security and validity checks
            if ( !$this->userCanExecute( $this->getUser() ) ) {
    Severity: Minor
    Found in src/Synchronization/ImportTranslationsSpecialPage.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 flatten has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        public function flatten( array $unflat ): array {
            $flat = [];
    
            foreach ( $unflat 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 execute has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        public function execute(): void {
            $days = (int)$this->getOption( 'days' ) ?: 7;
            $top = (int)$this->getOption( 'top' ) ?: 10;
            $bots = $this->hasOption( 'bots' );
    
    
    Severity: Minor
    Found in src/Statistics/LanguageEditStatsMaintenanceScript.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 checkNonSourceAdditionsForRename has a Cognitive Complexity of 13 (exceeds 5 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

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

        private function getWorkflowStates( MessageGroup $group ) {
            if ( MessageGroups::isDynamic( $group ) ) {
                return false;
            }
    
    
    Severity: Minor
    Found in src/MessageGroupProcessing/QueryMessageGroupsActionApi.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 makeRow has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        private function makeRow(
            StatsTable $table,
            string $languageCode,
            array $stats,
            MessageGroup $group,
    Severity: Minor
    Found in src/Statistics/MessageGroupStatsTable.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 isValid has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        public function isValid( &$reason ): bool {
            $group = $this->group;
            $pattern = $group->getSourceFilePath( '*' );
            $filename = $group->getSourceFilePath( $this->languageCode );
    
    
    Severity: Minor
    Found in src/MessageGroupProcessing/MessageGroupCache.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 writeReal has a Cognitive Complexity of 13 (exceeds 5 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

    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 getLookupRequest has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    EntitySelectorWidget.prototype.getLookupRequest = function () {
        var value = this.getValue();
        var widget = this;
    
        if ( !this.allowSuggestionsWhenEmpty && value === '' ) {
    Severity: Minor
    Found in resources/src/ext.translate.entity.selector/index.js - About 1 hr to fix

      Function displayOnMultipleSelection has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function displayOnMultipleSelection() {
              var selectedUserIDs = $( '.request-selector:checked' ).map( function ( i, checkedBox ) {
                  return $( checkedBox ).parents( 'div.request' ).data( 'data' ).userid;
              } ).toArray();
      
      
      Severity: Minor
      Found in resources/js/ext.translate.special.managetranslatorsandbox.js - About 1 hr to fix

        Function rgb has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        convert.hsl.rgb = function (hsl) {
            var h = hsl[0] / 360;
            var s = hsl[1] / 100;
            var l = hsl[2] / 100;
            var t1;
        Severity: Minor
        Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

          Function Color has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var Color = function (obj) {
              if (obj instanceof Color) {
                  return obj;
              }
              if (!(this instanceof Color)) {
          Severity: Minor
          Found in resources/lib/Chart.js/Chart.js - About 1 hr to fix

            Method doCreate has 39 lines of code (exceeds 25 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
              Severity
              Category
              Status
              Source
              Language