wikimedia/mediawiki-extensions-Translate

View on GitHub

Showing 1,238 of 1,238 total issues

Function run has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function run(): bool {
        // WARNING: Nothing here must not depend on message index being up to date.
        // For performance reasons, message index rebuild is run a separate job after
        // everything else is updated.

Severity: Minor
Found in src/PageTranslation/UpdateTranslatablePageJob.php - About 35 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 getInternalKey has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getInternalKey(): string {
        $mwServices = MediaWikiServices::getInstance();
        $nsInfo = $mwServices->getNamespaceInfo();
        $contentLanguage = $mwServices->getContentLanguage();

Severity: Minor
Found in src/MessageLoading/MessageHandle.php - About 35 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 preventDirectEditing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function preventDirectEditing( Title $title, User $user, $action, &$result ) {
        if ( self::$allowTargetEdit ) {
            return true;
        }

Severity: Minor
Found in src/PageTranslation/Hooks.php - About 35 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 deleteAsynchronously has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function deleteAsynchronously(
        Title $title,
        bool $isTranslation,
        UserIdentity $user,
        array $subpageList,
Severity: Minor
Found in src/PageTranslation/TranslatableBundleDeleter.php - About 35 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 renderTagPage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function renderTagPage( $wikitextParser, &$text, $state ): void {
        if ( $text === null ) {
            // SMW is unhelpfully sending null text if the source contains section tags. Do not explode.
            return;
        }
Severity: Minor
Found in src/PageTranslation/Hooks.php - About 35 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 translationPageHeader has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function translationPageHeader( IContextSource $context, TranslatablePage $page ) {
        global $wgTranslateKeepOutdatedTranslations;

        $title = $context->getTitle();
        if ( !$title->exists() ) {
Severity: Minor
Found in src/PageTranslation/Hooks.php - About 35 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 onSpecialRecentChangesPanel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function onSpecialRecentChangesPanel( &$extraOpts, $opts ) {
        global $wgLang, $wgRequest;
        if ( !$this->config->get( 'TranslateRecentChangesLanguageFilter' ) ) {
            return;
        }
Severity: Minor
Found in src/TranslatorInterface/CleanChangesFilters.php - About 35 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 getFallbacks has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getFallbacks( string $code ): array {
        global $wgTranslateLanguageFallbacks;
        $mwServices = MediaWikiServices::getInstance();

        // User preference has the final say
Severity: Minor
Found in src/TranslatorInterface/Aid/InOtherLanguagesAid.php - About 35 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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function update( MessageHandle $handle, ?string $targetText ): bool {
        if ( !$handle->isValid() || $handle->getCode() === '' ) {
            return false;
        }

Severity: Minor
Found in src/TtmServer/DatabaseTtmServer.php - About 35 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 getSupportUrl has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getSupportUrl( MessageHandle $handle ): string {
        $title = $handle->getTitle();
        $config = self::getConfig( $handle );

        $placeholders = [
Severity: Minor
Found in src/TranslatorInterface/Aid/SupportAid.php - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function getData( IReadableDatabase $db ): array {
        $autoload = $groups = $value = [];
        $parser = $this->messageGroupConfigurationParser;
        foreach ( $this->groupFiles as $configFile ) {
            $yaml = file_get_contents( $configFile );
Severity: Minor
Found in src/MessageGroupConfiguration/FileBasedMessageGroupFactory.php - About 35 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 formatRename has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function formatRename(
        MessageGroup $group,
        array $addedMsg,
        array $deletedMsg,
        string $language,
Severity: Minor
Found in src/Synchronization/ManageGroupsSpecialPage.php - About 35 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 searchStaticMessageGroups has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function searchStaticMessageGroups( string $query, int $maxResults, array $types = [] ): array {
        $cache = $this->cache;
        // None of the static groups currently use language-dependent labels. This
        // may need revisiting later and splitting the cache by language.
        $key = $cache->makeKey( 'Translate', 'EntitySearch', 'static-groups', '-v2' );
Severity: Minor
Found in src/TranslatorInterface/EntitySearch.php - About 35 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 getLanguages has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function getLanguages( array $facet ): array {
        $output = [];

        $nonDefaults = $this->opts->getChangedValues();
        $selected = $this->opts->getValue( 'language' );
Severity: Minor
Found in src/TtmServer/SearchTranslationsSpecialPage.php - About 35 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 startSync has a Cognitive Complexity of 7 (exceeds 5 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 35 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 create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function create( string $name ): TtmServer {
        if ( !$this->has( $name ) ) {
            throw new ServiceCreationFailure( "No configuration for name '$name'" );
        }

Severity: Minor
Found in src/TtmServer/TtmServerFactory.php - About 35 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 tabify has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function tabify( Skin $skin, array &$tabs ): void {
        $title = $skin->getTitle();
        if ( !$title->isSpecialPage() ) {
            return;
        }
Severity: Minor
Found in src/Synchronization/ManageGroupsSpecialPage.php - About 35 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 makeUserList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private function makeUserList( array $userStats ): void {
        $day = 60 * 60 * 24;

        // Scale of the activity colors, anything
        // longer than this is just inactive
Severity: Minor
Found in src/Statistics/ActiveLanguagesSpecialPage.php - About 35 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 matches has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function matches( string $key ): bool {
        if ( in_array( $key, $this->aExact ) ) {
            return true;
        }

Severity: Minor
Found in src/MessageProcessing/StringMatcher.php - About 35 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 canImportGroup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function canImportGroup( MessageGroup $group, bool $skipGroupSyncCache ): Status {
        $groupId = $group->getId();
        if ( !$group instanceof FileBasedMessageGroup ) {
            $error = "Group $groupId expected to be FileBasedMessageGroup, got " . get_class( $group ) . " instead.";
            return Status::newFatal( new RawMessage( $error ) );
Severity: Minor
Found in src/Synchronization/ExternalMessageSourceStateImporter.php - About 35 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