eveseat/installer

View on GitHub

Showing 126 of 126 total issues

File PackageInstaller.php has 316 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/*
 * This file is part of SeAT
 *
Severity: Minor
Found in src/Utils/PackageInstaller.php - About 3 hrs to fix

    Method alt_stat has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function alt_stat($file)
        {
    
            clearstatcache();
            $ss = @stat($file);
    Severity: Major
    Found in src/helpers.php - About 2 hrs to fix

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

          public function findSeatInstallation(): string
          {
      
              $fs = new Filesystem();
      
      
      Severity: Minor
      Found in src/Traits/FindsSeatInstallations.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

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

          protected function findAndSetSeatPath(InputInterface $input)
          {
      
              // Check if we have a path to test, or should autodetect.
              if (! is_null($input->getOption('seat-path'))) {
      Severity: Major
      Found in src/Commands/Run.php and 1 other location - About 1 hr to fix
      src/Commands/Update/SeatCommand.php on lines 120..139

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 118.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

          protected function findAndSetSeatPath(InputInterface $input)
          {
      
              // Check if we have a path to test, or should autodetect.
              if (! is_null($input->getOption('seat-path'))) {
      Severity: Major
      Found in src/Commands/Update/SeatCommand.php and 1 other location - About 1 hr to fix
      src/Commands/Run.php on lines 95..114

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 118.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Avoid excessively long variable names like $serverblock_locations. Keep variable name length under 20.
      Open

          protected $serverblock_locations = [
              'ubuntu' => '/etc/nginx/sites-enabled/100-seat.conf',
              'centos' => '/etc/nginx/nginx.conf',
              'debian' => '/etc/nginx/sites-enabled/100-seat.conf',
          ];
      Severity: Minor
      Found in src/Utils/Nginx.php by phpmd

      LongVariable

      Since: 0.2

      Detects when a field, formal or local variable is declared with a long name.

      Example

      class Something {
          protected $reallyLongIntName = -3; // VIOLATION - Field
          public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
              $otherReallyLongName = -5; // VIOLATION - Local
              for ($interestingIntIndex = 0; // VIOLATION - For
                   $interestingIntIndex < 10;
                   $interestingIntIndex++ ) {
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#longvariable

      Avoid excessively long variable names like $restart_enable_commands. Keep variable name length under 20.
      Open

          protected $restart_enable_commands = [
              'ubuntu' => [
                  '16.04' => [
                      'systemctl enable mysql.service',
                      'systemctl restart mysql.service',
      Severity: Minor
      Found in src/Utils/MySql.php by phpmd

      LongVariable

      Since: 0.2

      Detects when a field, formal or local variable is declared with a long name.

      Example

      class Something {
          protected $reallyLongIntName = -3; // VIOLATION - Field
          public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
              $otherReallyLongName = -5; // VIOLATION - Local
              for ($interestingIntIndex = 0; // VIOLATION - For
                   $interestingIntIndex < 10;
                   $interestingIntIndex++ ) {
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#longvariable

      Avoid excessively long variable names like $secure_install_scripts. Keep variable name length under 20.
      Open

          protected $secure_install_scripts = [
              'ubuntu' => 'mysql_secure_installation.ubuntu.bash',
              'centos' => 'mysql_secure_installation.centos.bash',
              'debian' => 'mysql_secure_installation.debian.bash',
          ];
      Severity: Minor
      Found in src/Utils/MySql.php by phpmd

      LongVariable

      Since: 0.2

      Detects when a field, formal or local variable is declared with a long name.

      Example

      class Something {
          protected $reallyLongIntName = -3; // VIOLATION - Field
          public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
              $otherReallyLongName = -5; // VIOLATION - Local
              for ($interestingIntIndex = 0; // VIOLATION - For
                   $interestingIntIndex < 10;
                   $interestingIntIndex++ ) {
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#longvariable

      Avoid excessively long variable names like $php_extention_packages. Keep variable name length under 20.
      Open

          protected $php_extention_packages = [
              'ubuntu' => [
                  '16.04' => [
                      'pdo_mysql' => 'php7.1-mysql',
                      'posix'     => 'php7.1-common',
      Severity: Minor
      Found in src/Utils/PackageInstaller.php by phpmd

      LongVariable

      Since: 0.2

      Detects when a field, formal or local variable is declared with a long name.

      Example

      class Something {
          protected $reallyLongIntName = -3; // VIOLATION - Field
          public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
              $otherReallyLongName = -5; // VIOLATION - Local
              for ($interestingIntIndex = 0; // VIOLATION - For
                   $interestingIntIndex < 10;
                   $interestingIntIndex++ ) {
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#longvariable

      Avoid excessively long variable names like $supervisor_config_locations. Keep variable name length under 20.
      Open

          protected $supervisor_config_locations = [
              'ubuntu' => [
                  '16.04' => '/etc/supervisor/supervisord.conf',
                  '18.04' => '/etc/supervisor/supervisord.conf',
                  '20.04' => '/etc/supervisor/supervisord.conf',
      Severity: Minor
      Found in src/Utils/Supervisor.php by phpmd

      LongVariable

      Since: 0.2

      Detects when a field, formal or local variable is declared with a long name.

      Example

      class Something {
          protected $reallyLongIntName = -3; // VIOLATION - Field
          public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
              $otherReallyLongName = -5; // VIOLATION - Local
              for ($interestingIntIndex = 0; // VIOLATION - For
                   $interestingIntIndex < 10;
                   $interestingIntIndex++ ) {
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#longvariable

      Avoid excessively long variable names like $seat_config_locations. Keep variable name length under 20.
      Open

          protected $seat_config_locations = [
              'ubuntu' => [
                  '16.04' => '/etc/supervisor/conf.d/seat.conf',
                  '18.04' => '/etc/supervisor/conf.d/seat.conf',
                  '20.04' => '/etc/supervisor/conf.d/seat.conf',
      Severity: Minor
      Found in src/Utils/Supervisor.php by phpmd

      LongVariable

      Since: 0.2

      Detects when a field, formal or local variable is declared with a long name.

      Example

      class Something {
          protected $reallyLongIntName = -3; // VIOLATION - Field
          public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
              $otherReallyLongName = -5; // VIOLATION - Local
              for ($interestingIntIndex = 0; // VIOLATION - For
                   $interestingIntIndex < 10;
                   $interestingIntIndex++ ) {
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#longvariable

      Avoid excessively long variable names like $enable_restart_commands. Keep variable name length under 20.
      Open

          protected $enable_restart_commands = [
              'ubunutu' => [
                  '16.04' => [
                      'systemctl enable redis-server.service',
                      'systemctl restart redis-server.service',
      Severity: Minor
      Found in src/Utils/Redis.php by phpmd

      LongVariable

      Since: 0.2

      Detects when a field, formal or local variable is declared with a long name.

      Example

      class Something {
          protected $reallyLongIntName = -3; // VIOLATION - Field
          public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
              $otherReallyLongName = -5; // VIOLATION - Local
              for ($interestingIntIndex = 0; // VIOLATION - For
                   $interestingIntIndex < 10;
                   $interestingIntIndex++ ) {
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#longvariable

      Method configureMySql has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function configureMySql()
          {
      
              $mysql = new MySql($this->io);
      
      
      Severity: Minor
      Found in src/Commands/Install/Production.php - About 1 hr to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            protected $restart_commands = [
                'ubuntu' => [
                    '16.04' => [
                        'systemctl restart nginx.service',
                        'systemctl restart php7.1-fpm.service',
        Severity: Major
        Found in src/Utils/Nginx.php and 1 other location - About 1 hr to fix
        src/Utils/MySql.php on lines 60..95

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 109.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            protected $restart_enable_commands = [
                'ubuntu' => [
                    '16.04' => [
                        'systemctl enable mysql.service',
                        'systemctl restart mysql.service',
        Severity: Major
        Found in src/Utils/MySql.php and 1 other location - About 1 hr to fix
        src/Utils/Nginx.php on lines 108..143

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 109.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

            public function configure(string $path)
            {
                $this->io->text('Writing the Nginx Server block configuration');
        
                // Get the OS that will be used to determine where the config will be
        Severity: Minor
        Found in src/Utils/Nginx.php - About 1 hr to fix

          Function checkCommandRequirements has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function checkCommandRequirements(array $commands = null)
              {
          
                  // Map the executables from the function argument if needed
                  if ($commands)
          Severity: Minor
          Found in src/Utils/Requirements.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 checkPhpRequirements has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              public function checkPhpRequirements(): bool
              {
          
                  if (version_compare(phpversion(), '7.1', '<')) {
          
          
          Severity: Minor
          Found in src/Utils/Requirements.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 execute has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function execute(InputInterface $input, OutputInterface $output)
              {
          
                  // Bind the input and output for later use in other methods.
                  $this->io = new SymfonyStyle($input, $output);
          Severity: Minor
          Found in src/Commands/Install/Development.php - About 1 hr to fix

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

                public function configure(string $path)
                {
            
                    $this->io->text('Writing the Apache Virtual Host configuration');
            
            
            Severity: Minor
            Found in src/Utils/Apache.php - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language