wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 994 of 1,238 total issues

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

        Language $contLang,
        NamespaceInfo $nsInfo,
        RevisionLookup $revLookup,
        GroupSynchronizationCache $synchronizationCache,
        JobQueueGroup $jobQueueGroup,
Severity: Major
Found in src/Synchronization/ManageGroupsSpecialPage.php - About 1 hr to fix

    Function determineStatus has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function determineStatus(
            ?int $readyRevisionId,
            ?int $markRevisionId,
            int $latestRevisionId
        ): ?TranslatablePageStatus {
    Severity: Minor
    Found in src/PageTranslation/TranslatablePage.php - About 55 mins 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 9 (exceeds 5 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 55 mins 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 getNormalForm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        private function getNormalForm(): HTMLForm {
            $fields = [];
    
            // Allow subscribers to manipulate the list of watched pages (or use it
            // to preload lots of details at once)
    Severity: Minor
    Found in src/PageTranslation/ManageMessageGroupSubscriptionsSpecialPage.php - About 55 mins 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 filterOnCondition has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        private function filterOnCondition( array $keys, array $condKeys, bool $condition = true ): array {
            if ( $condition ) {
                // Delete $condKeys from $keys
                foreach ( array_keys( $condKeys ) as $key ) {
                    unset( $keys[$key] );
    Severity: Minor
    Found in src/MessageLoading/MessageCollection.php - About 55 mins 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 extractMessageData has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        private function extractMessageData(
            ApiResult $result,
            array $props,
            Message $message
        ): array {
    Severity: Minor
    Found in src/MessageLoading/QueryMessageCollectionActionApi.php - About 55 mins 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 translateTab has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function translateTab( Skin $skin, array &$tabs ) {
            $title = $skin->getTitle();
            $handle = new MessageHandle( $title );
            $code = $handle->getCode();
            $page = TranslatablePage::isTranslationPage( $title );
    Severity: Minor
    Found in src/PageTranslation/Hooks.php - About 55 mins 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 9 (exceeds 5 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 55 mins 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 getOutput has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        private function getOutput( MessageGroup $group ): array {
            $out = [];
    
            $groupId = $group->getId();
            $sourceLanguage = $group->getSourceLanguage();
    Severity: Minor
    Found in src/TtmServer/ExportTtmServerDumpMaintenanceScript.php - About 55 mins 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 getQueryableServicesUncached has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        private function getQueryableServicesUncached( array $services ): array {
            // Remove writable services
            $writableServices = $this->ttmServerFactory->getWriteOnly();
            foreach ( array_keys( $writableServices ) as $serviceId ) {
                unset( $services[ $serviceId ] );
    Severity: Minor
    Found in src/TranslatorInterface/Aid/TTMServerAid.php - About 55 mins 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 parseResponse has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function parseResponse( TranslationQueryResponse $reply ): string {
            $body = $reply->getBody();
            $response = FormatJson::decode( $body );
            if ( !is_array( $response ) ) {
                throw new TranslationWebServiceException( 'Invalid json: ' . serialize( $body ) );
    Severity: Minor
    Found in src/WebService/CaighdeanWebService.php - About 55 mins 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 messageSelector has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        private function messageSelector(): string {
            $nonDefaults = $this->opts->getChangedValues();
            $output = Html::openElement( 'div', [ 'class' => 'row tux-messagetable-header' ] );
            $output .= Html::openElement( 'div', [ 'class' => 'twelve columns' ] );
            $output .= Html::openElement( 'ul', [ 'class' => 'row tux-message-selector' ] );
    Severity: Minor
    Found in src/TtmServer/SearchTranslationsSpecialPage.php - About 55 mins 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 showTranslations has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        private function showTranslations( Title $title ): void {
            $handle = new MessageHandle( $title );
            $namespace = $title->getNamespace();
            $message = $handle->getKey();
    
    
    Severity: Minor
    Found in src/TranslatorInterface/TranslationsSpecialPage.php - About 55 mins 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 processQueryResults has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        private function processQueryResults( IResultWrapper $res, string $text, string $targetLanguage ): array {
            $timeLimit = microtime( true ) + 5;
    
            $lenA = mb_strlen( $text );
            $results = [];
    Severity: Minor
    Found in src/TtmServer/DatabaseTtmServer.php - About 55 mins 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 getData has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getData(): array {
            $db = Utilities::getSafeReadDB();
    
            $revTagStore = Services::getInstance()->getRevTagStore();
    
    
    Severity: Minor
    Found in src/TranslatorInterface/Aid/UpdatedDefinitionAid.php - About 55 mins 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 doFuzzy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function doFuzzy(
            Title $title,
            string $message,
            string $comment,
            ?User $user
    Severity: Minor
    Found in src/Synchronization/MessageWebImporter.php - About 55 mins 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 isExcluded has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public function isExcluded( MessageGroup $group, string $code ): bool {
            $excluded = null;
            $groupId = $group->getId();
    
            $checks = [
    Severity: Minor
    Found in src/Statistics/StatsTable.php - About 55 mins 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 isExcluded has a Cognitive Complexity of 9 (exceeds 5 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 55 mins 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 handleRename has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        private function handleRename( string $target, string $replacement ): ?Title {
            $newSourceTitle = null;
    
            $sourceMessageHandle = new MessageHandle( $this->title );
            $movableTitles = TranslateReplaceTitle::getTitlesForMove( $sourceMessageHandle, $replacement );
    Severity: Minor
    Found in src/Synchronization/UpdateMessageJob.php - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public function execute() {
            $this->language = $this->getServiceContainer()->getContentLanguage();
    
            $groupInput = $this->getOption( 'group', '*' );
            $groupIdPattern = self::commaList2Array( $groupInput );
    Severity: Minor
    Found in src/Diagnostics/RefreshTranslationProgressStatsMaintenanceScript.php - About 55 mins 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