hnhdigital-os/mysql-helper

View on GitHub

Showing 29 of 103 total issues

Function handle has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

    public function handle()
    {
        if (!$this->checkInstalledPackages()) {
            return;
        }
Severity: Minor
Found in app/Commands/CloneCommand.php - About 6 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 handle has 88 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function handle()
    {
        if (!$this->checkInstalledPackages()) {
            return;
        }
Severity: Major
Found in app/Commands/CloneCommand.php - About 3 hrs to fix

    File CloneCommand.php has 296 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace App\Commands;
    
    use App\Traits\SharedTrait;
    Severity: Minor
    Found in app/Commands/CloneCommand.php - About 3 hrs to fix

      Method updateRemoteProfile has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function updateRemoteProfile($profile, $name)
          {
              $data = array_get($this->profiles, $profile.'.remote.'.$name, []);
      
              $public_key = array_get($data, 'public_key', $this->getUserHome('.ssh/id_rsa.pub'));
      Severity: Major
      Found in app/Commands/ConfigureCommand.php - About 2 hrs to fix

        ConfigureCommand has 21 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class ConfigureCommand extends Command
        {
            use CommandInternalsTrait, FileSystemTrait, SharedTrait;
        
            /**
        Severity: Minor
        Found in app/Commands/ConfigureCommand.php - About 2 hrs to fix

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

              private function updateRemoteProfileKey($profile, $name, $key)
              {
                  $default_value = '';
          
                  switch ($key) {
          Severity: Minor
          Found in app/Commands/ConfigureCommand.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 cloneLocalDatabases has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function cloneLocalDatabases($profile, $connection, $source_database, $destination_database)
              {
                  // Check we want to proceed.
                  if (intval($this->option('no-interaction')) < 1
                      && !$this->confirm('Did you want to proceed?')) {
          Severity: Minor
          Found in app/Commands/CloneCommand.php - About 1 hr to fix

            Method execRemoteConnection has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function execRemoteConnection($profile, $name, $command)
                {
                    if (!array_get($this->profiles, $profile.'.remote.'.$name.'.working', false)) {
                        $this->error('Remote profile has not been tested. Use configure command to fix.');
            
            
            Severity: Minor
            Found in app/Traits/SharedTrait.php - About 1 hr to fix

              Method updateRemoteProfileKey has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function updateRemoteProfileKey($profile, $name, $key)
                  {
                      $default_value = '';
              
                      switch ($key) {
              Severity: Minor
              Found in app/Commands/ConfigureCommand.php - About 1 hr to fix

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

                    private function testRemoteProfile($profile, $name)
                    {
                        $connection_works = false;
                
                        $data = array_get($this->profiles, $profile.'.remote.'.$name, []);
                Severity: Minor
                Found in app/Commands/ConfigureCommand.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 cloneRemoteDatabases has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function cloneRemoteDatabases($profile, $remote, $remote_profile, $remote_connection, $local_connection, $source_database, $destination_database)
                    {
                        // Check we want to proceed.
                        if (intval($this->option('no-interaction')) < 1
                            && !$this->confirm('Did you want to proceed?')) {
                Severity: Minor
                Found in app/Commands/CloneCommand.php - About 1 hr to fix

                  Function sshConnect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function sshConnect($host, $port, $method, $settings)
                      {
                          try {
                              $session = ssh2_connect($host, $port);
                          } catch (\Exception $e) {
                  Severity: Minor
                  Found in app/Commands/ConfigureCommand.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

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

                      private function cloneRemoteDatabases($profile, $remote, $remote_profile, $remote_connection, $local_connection, $source_database, $destination_database)
                  Severity: Major
                  Found in app/Commands/CloneCommand.php - About 50 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return $this->updateRemoteProfileKey($profile, $name, $option);
                    Severity: Major
                    Found in app/Commands/ConfigureCommand.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                          return 1;
                      Severity: Major
                      Found in app/Commands/CloneCommand.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return 1;
                        Severity: Major
                        Found in app/Commands/CloneCommand.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return $this->cloneRemoteDatabases(
                                          $profile,
                                          $remote,
                                          $remote_profile,
                                          $remote_connection,
                          Severity: Major
                          Found in app/Commands/CloneCommand.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                                return 1;
                            Severity: Major
                            Found in app/Commands/CloneCommand.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                                  return 1;
                              Severity: Major
                              Found in app/Commands/CloneCommand.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                                return $this->updateRemoteProfileName($profile, $name, $option);
                                Severity: Major
                                Found in app/Commands/ConfigureCommand.php - About 30 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language