wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

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

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

    public function hasOnly( $language, $type ) {
        $deletions = $this->getDeletions( $language );
        $additions = $this->getAdditions( $language );
        $renames = $this->getRenames( $language );
        $changes = $this->getChanges( $language );
Severity: Minor
Found in src/MessageSync/MessageSourceChange.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 levenshtein has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function levenshtein( string $str1, string $str2, int $length1, int $length2 ): int {
        if ( $length1 === 0 ) {
            return $length2;
        }

Severity: Minor
Found in src/Utilities/StringComparators/EditDistanceStringComparator.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 handleNew has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function handleNew(
        MessageSourceChange $sourceChanges,
        string $msgKey,
        string $sourceLang
    ): void {
Severity: Minor
Found in src/MessageGroupProcessing/ManageMessageGroupsActionApi.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 calculateAggregateGroup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private static function calculateAggregateGroup(
        array &$stats,
        AggregateMessageGroup $group,
        string $code,
        int $flags
Severity: Minor
Found in src/Statistics/MessageGroupStats.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 get has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function get(
        array $stats,
        MessageGroup $group,
        bool $noComplete,
        bool $noEmpty
Severity: Minor
Found in src/Statistics/MessageGroupStatsTable.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