wikimedia/mediawiki-extensions-Translate

View on GitHub
src/Synchronization/ExternalMessageSourceStateImporter.php

Summary

Maintainability
C
1 day
Test Coverage

Function import has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function import( array $changeData, string $name, int $importStrategy ): array {
        $processed = [];
        $skipped = [];
        $jobs = [];

Severity: Minor
Found in src/Synchronization/ExternalMessageSourceStateImporter.php - About 3 hrs 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 identifySafeLanguages has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    private function identifySafeLanguages(
        FileBasedMessageGroup $group,
        MessageSourceChange $changesForGroup,
        int $importStrategy
    ): array {
Severity: Minor
Found in src/Synchronization/ExternalMessageSourceStateImporter.php - About 3 hrs 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

Method import has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function import( array $changeData, string $name, int $importStrategy ): array {
        $processed = [];
        $skipped = [];
        $jobs = [];

Severity: Major
Found in src/Synchronization/ExternalMessageSourceStateImporter.php - About 2 hrs to fix

    Method identifySafeLanguages has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function identifySafeLanguages(
            FileBasedMessageGroup $group,
            MessageSourceChange $changesForGroup,
            int $importStrategy
        ): array {
    Severity: Minor
    Found in src/Synchronization/ExternalMessageSourceStateImporter.php - About 1 hr to fix

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

              GroupSynchronizationCache $groupSynchronizationCache,
              JobQueueGroup $jobQueueGroup,
              LoggerInterface $logger,
              MessageIndex $messageIndex,
              TitleFactory $titleFactory,
      Severity: Major
      Found in src/Synchronization/ExternalMessageSourceStateImporter.php - About 50 mins to fix

        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

        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

        There are no issues that match your filters.

        Category
        Status