owncloud/core

View on GitHub
core/Command/Db/ConvertType.php

Summary

Maintainability
D
1 day
Test Coverage

File ConvertType.php has 352 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * @author Andreas Fischer <bantu@owncloud.com>
 * @author Bart Visscher <bartv@thisnet.nl>
 * @author Joas Schilling <coding@schilljs.com>
Severity: Minor
Found in core/Command/Db/ConvertType.php - About 4 hrs to fix

    Function copyTable has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function copyTable(Connection $fromDB, Connection $toDB, Table $table, InputInterface $input, OutputInterface $output) {
            $tableName = $table->getName();
            $chunkSize = $input->getOption('chunk-size');
    
            $progress = new ProgressBar($output);
    Severity: Minor
    Found in core/Command/Db/ConvertType.php - About 2 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 copyTable has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function copyTable(Connection $fromDB, Connection $toDB, Table $table, InputInterface $input, OutputInterface $output) {
            $tableName = $table->getName();
            $chunkSize = $input->getOption('chunk-size');
    
            $progress = new ProgressBar($output);
    Severity: Major
    Found in core/Command/Db/ConvertType.php - About 2 hrs to fix

      Method configure has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function configure() {
              $this
                  ->setName('db:convert-type')
                  ->setDescription('Convert the ownCloud database to the newly configured one. This feature is currently experimental.')
                  ->addArgument(
      Severity: Major
      Found in core/Command/Db/ConvertType.php - About 2 hrs to fix

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

            protected function execute(InputInterface $input, OutputInterface $output): int {
                $output->writeln('<info>This feature is currently experimental.</info>');
                $this->targetType = $this->connectionFactory->normalizeType($input->getArgument('type'));
                $this->targetHostname = $input->getArgument('hostname');
                $this->targetPort = $input->getOption('port');
        Severity: Minor
        Found in core/Command/Db/ConvertType.php - About 1 hr to fix

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

              protected function convertDB(Connection $fromDB, Connection $toDB, array $tables, InputInterface $input, OutputInterface $output) {
                  $this->config->setSystemValue('maintenance', true);
                  try {
                      $fromSchema = $fromDB->createSchema();
                      // copy table rows
          Severity: Minor
          Found in core/Command/Db/ConvertType.php - About 1 hr to fix

            Method convertDB has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                protected function convertDB(Connection $fromDB, Connection $toDB, array $tables, InputInterface $input, OutputInterface $output) {
            Severity: Minor
            Found in core/Command/Db/ConvertType.php - About 35 mins to fix

              Method copyTable has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  protected function copyTable(Connection $fromDB, Connection $toDB, Table $table, InputInterface $input, OutputInterface $output) {
              Severity: Minor
              Found in core/Command/Db/ConvertType.php - About 35 mins to fix

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

                    protected function convertDB(Connection $fromDB, Connection $toDB, array $tables, InputInterface $input, OutputInterface $output) {
                        $this->config->setSystemValue('maintenance', true);
                        try {
                            $fromSchema = $fromDB->createSchema();
                            // copy table rows
                Severity: Minor
                Found in core/Command/Db/ConvertType.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

                    protected function execute(InputInterface $input, OutputInterface $output): int {
                        $output->writeln('<info>This feature is currently experimental.</info>');
                        $this->targetType = $this->connectionFactory->normalizeType($input->getArgument('type'));
                        $this->targetHostname = $input->getArgument('hostname');
                        $this->targetPort = $input->getOption('port');
                Severity: Minor
                Found in core/Command/Db/ConvertType.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