wikimedia/mediawiki-extensions-Translate

View on GitHub
src/Synchronization/MessageWebImporter.php

Summary

Maintainability
F
3 days
Test Coverage

Function execute has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
Open

    public function execute( array $messages ): bool {
        $context = RequestContext::getMain();
        $output = $context->getOutput();

        // Set up diff engine
Severity: Minor
Found in src/Synchronization/MessageWebImporter.php - About 1 day 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 execute has 149 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function execute( array $messages ): bool {
        $context = RequestContext::getMain();
        $output = $context->getOutput();

        // Set up diff engine
Severity: Major
Found in src/Synchronization/MessageWebImporter.php - About 5 hrs to fix

    File MessageWebImporter.php has 402 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    declare( strict_types = 1 );
    
    namespace MediaWiki\Extension\Translate\Synchronization;
    
    
    Severity: Minor
    Found in src/Synchronization/MessageWebImporter.php - About 5 hrs to fix

      MessageWebImporter has 22 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class MessageWebImporter {
          private Title $title;
          private User $user;
          private MessageGroup $group;
          private string $code;
      Severity: Minor
      Found in src/Synchronization/MessageWebImporter.php - About 2 hrs to fix

        Method doFuzzy has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function doFuzzy(
                Title $title,
                string $message,
                string $comment,
                ?User $user
        Severity: Major
        Found in src/Synchronization/MessageWebImporter.php - About 2 hrs to fix

          Function doAction has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              private function doAction(
                  string $action,
                  MessageGroup $group,
                  string $key,
                  string $message
          Severity: Minor
          Found in src/Synchronization/MessageWebImporter.php - About 1 hr 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

          There are no issues that match your filters.

          Category
          Status