wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 994 of 1,238 total issues

Function showConfirmation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function showConfirmation(): void {
        $out = $this->getOutput();
        $count = 0;
        $subpageCount = 0;

Severity: Minor
Found in src/PageTranslation/DeleteTranslatableBundleSpecialPage.php - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute( $par ) {
        $this->setHeaders();
        $this->outputHeader();

        $out = $this->getOutput();
Severity: Minor
Found in src/TranslatorInterface/TranslationsSpecialPage.php - About 25 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 doPairs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function doPairs(): array {
        if ( !isset( $this->config['key'] ) ) {
            throw new TranslationWebServiceConfigurationException( 'key is not set' );
        }

Severity: Minor
Found in src/WebService/MicrosoftWebService.php - About 25 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 getServersToUpdate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function getServersToUpdate( ?string $requestedServiceId ): array {
        $ttmServerFactory = Services::getInstance()->getTtmServerFactory();
        if ( $requestedServiceId ) {
            if ( !$ttmServerFactory->has( $requestedServiceId ) ) {
                $this->logger->warning(
Severity: Minor
Found in src/TtmServer/TtmServerMessageUpdateJob.php - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute(): void {
        if ( !$this->isSandboxEnabled ) {
            $this->dieWithError( 'apierror-translate-sandboxdisabled', 'sandboxdisabled' );
        }

Severity: Minor
Found in src/TranslatorSandbox/TranslatorSandboxActionApi.php - About 25 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 getWriteOnly has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getWriteOnly(): array {
        $ttmServerIds = $this->getNames();
        $writableServers = [];
        foreach ( $ttmServerIds as $serverId ) {
            if ( $this->configs[ $serverId ][ 'writable' ] ?? false ) {
Severity: Minor
Found in src/TtmServer/TtmServerFactory.php - About 25 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 preventCategorization has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function preventCategorization( Parser $parser, string &$html ): void {
        if ( $parser->getOptions()->getInterfaceMessage() ) {
            return;
        }
        $pageReference = $parser->getPage();
Severity: Minor
Found in src/HookHandler.php - About 25 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 createUpdateMessageJobs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function createUpdateMessageJobs(
        FileBasedMessageGroup $group,
        array $additions,
        string $language
    ): array {
Severity: Minor
Found in src/Synchronization/ExternalMessageSourceStateImporter.php - About 25 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 makeWorkflowStateCell has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function makeWorkflowStateCell( ?string $state, MessageGroup $group, string $language ): string {
        if ( $state === null || $group->getSourceLanguage() === $language ) {
            return "\n\t\t" . $this->element( '', '', '-1' );
        }

Severity: Minor
Found in src/Statistics/StatsTable.php - About 25 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 onAbuseFilterComputeVariable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function onAbuseFilterComputeVariable(
        string $method,
        VariableHolder $vars,
        array $parameters,
        ?string &$result
Severity: Minor
Found in src/HookHandler.php - About 25 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 getMessageInfoHtml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function getMessageInfoHtml( MessageUpdateParameter $message, Language $language ): string {
        $output = Html::openElement( 'dl' );

        $tags = [];
        if ( $message->isFuzzy() ) {
Severity: Minor
Found in src/Synchronization/DisplayGroupSynchronizationInfo.php - About 25 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 makeGroupRow has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function makeGroupRow(
        MessageGroup $group,
        array $cache,
        MessageGroup $parent = null,
        int $depth = 0
Severity: Minor
Found in src/Statistics/LanguageStatsSpecialPage.php - About 25 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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function run(): bool {
        $lb = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
        if ( !$lb->waitForReplication() ) {
            $this->logWarning( 'Continuing despite replication lag' );
        }
Severity: Minor
Found in src/MessageGroupProcessing/MessageGroupStatesUpdaterJob.php - About 25 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 import has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function import(
        string $importFilePath,
        string $interwikiPrefix,
        bool $assignKnownUsers,
        UserIdentity $user,
Severity: Minor
Found in src/MessageGroupProcessing/TranslatableBundleImporter.php - About 25 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 getGroupsWithTransitions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getGroupsWithTransitions( MessageHandle $handle ): array {
        $listeners = [];
        foreach ( $handle->getGroupIds() as $id ) {
            $group = MessageGroups::getGroup( $id );

Severity: Minor
Found in src/MessageGroupProcessing/MessageGroupStatesUpdaterJob.php - About 25 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 labelExists has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function labelExists( string $name ): bool {
        $groups = self::getAllGroups();
        foreach ( $groups as $group ) {
            if ( $group instanceof AggregateMessageGroup ) {
                if ( $group->getLabel() === $name ) {
Severity: Minor
Found in src/MessageGroupProcessing/MessageGroups.php - About 25 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 validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate( $value, $alldata ) {
        $p = parent::validate( $value, $alldata );

        if ( $p !== true ) {
            return $p;
Severity: Minor
Found in src/Utilities/HTMLJsSelectToInputField.php - About 25 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 runInParallel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function runInParallel( callable $mainThread, callable $forkThread ): void {
        // Fork to increase speed with parallelism. Also helps with memory usage if there are leaks.
        $pid = -1;
        if ( function_exists( 'pcntl_fork' ) ) {
            $pid = pcntl_fork();
Severity: Minor
Found in src/Utilities/ParallelExecutor.php - About 25 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 forAll has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function forAll( string ...$prefixedMessagesKeys ): array {
        $languages = MessageGroupStats::getLanguages();
        $stats = [];

        if ( !$prefixedMessagesKeys ) {
Severity: Minor
Found in src/Statistics/MessagePrefixStats.php - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute() {
        $services = MediaWikiServices::getInstance();
        $db = $services->getDBLoadBalancer()->getConnection( DB_PRIMARY );

        $dbGroupIds = $db->newSelectQueryBuilder()
Severity: Minor
Found in src/Statistics/CleanupTranslationProgressStatsMaintenanceScript.php - About 25 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