wikimedia/mediawiki-extensions-Translate

View on GitHub
scripts/ttmserver-export.php

Summary

Maintainability
D
2 days
Test Coverage

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

    public function execute() {
        $dryRun = $this->hasOption( 'dry-run' );
        $ttmServerId = $this->getOption( 'ttmserver' );
        $shouldReindex = $this->getOption( 'reindex', false );

Severity: Minor
Found in scripts/ttmserver-export.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

File ttmserver-export.php has 313 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Script to bootstrap TtmServer translation memory
 *
 * @author Niklas Laxström
Severity: Minor
Found in scripts/ttmserver-export.php - About 3 hrs to fix

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

        public function execute() {
            $dryRun = $this->hasOption( 'dry-run' );
            $ttmServerId = $this->getOption( 'ttmserver' );
            $shouldReindex = $this->getOption( 'reindex', false );
    
    
    Severity: Major
    Found in scripts/ttmserver-export.php - About 2 hrs to fix

      Method exportGroup has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function exportGroup( MessageGroup $group, array $servers ): void {
              $times = [
                  'total' => -microtime( true ),
                  'stats' => 0,
                  'init' => 0,
      Severity: Major
      Found in scripts/ttmserver-export.php - About 2 hrs to fix

        Function exportGroup has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            private function exportGroup( MessageGroup $group, array $servers ): void {
                $times = [
                    'total' => -microtime( true ),
                    'stats' => 0,
                    'init' => 0,
        Severity: Minor
        Found in scripts/ttmserver-export.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 getServers has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            private function getServers(
                bool $isDryRun,
                bool $shouldReindex,
                ?string $ttmServerId = null
            ): array {
        Severity: Minor
        Found in scripts/ttmserver-export.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

        Method __construct has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function __construct() {
                parent::__construct();
                $this->addDescription( 'Script to bootstrap TtmServer.' );
                $this->addOption(
                    'threads',
        Severity: Minor
        Found in scripts/ttmserver-export.php - About 1 hr to fix

          Method getServers has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function getServers(
                  bool $isDryRun,
                  bool $shouldReindex,
                  ?string $ttmServerId = null
              ): array {
          Severity: Minor
          Found in scripts/ttmserver-export.php - About 1 hr to fix

            There are no issues that match your filters.

            Category
            Status