AOEpeople/StackFormation

View on GitHub

Showing 102 of 102 total issues

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

    public function getPreprocessedTemplate($force = false)
    {
        // Gather dependencies and create blueprint references
        $this->getStackName();
        $this->getProfile();
Severity: Minor
Found in src/StackFormation/Blueprint.php - About 1 hr to fix

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

        protected function configure()
        {
            $this
                ->setName('ec2:ssh')
                ->setAliases(['ssh'])
    Severity: Minor
    Found in src/AwsInspector/Command/Ec2/SshCommand.php - About 1 hr to fix

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

          protected function execute(InputInterface $input, OutputInterface $output)
          {
              // TODO: refactor this to use \AwsInspector\Model\CloudWatchLogs\Repository
      
              $groupPattern = $input->getArgument('group');

        Method getDetailedLogFromResourceStatusReason has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getDetailedLogFromResourceStatusReason($resourceStatusReason)
            {
                $logMessages = [];
                if (preg_match('/See the details in CloudWatch Log Stream: (.*)/', $resourceStatusReason, $matches)) {
                    $logStream = $matches[1];
        Severity: Minor
        Found in src/StackFormation/Helper/StackEventsTable.php - About 1 hr to fix

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

              protected function execute(InputInterface $input, OutputInterface $output)
              {
                  $tags = $input->getOption('tag');
                  $tags = $this->convertTags($tags);
          
          
          Severity: Minor
          Found in src/AwsInspector/Command/Ec2/ListCommand.php - About 1 hr to fix

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

                protected function interact(InputInterface $input, OutputInterface $output)
                {
                    $logGroupName = $input->getArgument('group') ?: '*';
            
                    $repository = new Repository();
            Severity: Minor
            Found in src/AwsInspector/Command/CloudwatchLogs/TailCommand.php - About 1 hr to fix

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

                  public static function findCloudWatchLogGroupByStream($stream, $logGroupNamePrefix = null)
                  {
                      return null; // TODO: FIx this!
              
              
              
              Severity: Minor
              Found in src/StackFormation/Helper/Finder.php - About 1 hr to fix

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

                    public function getEnvVarsForProfile($profile) {
                        $envVars = [];
                        if (!$this->isValidProfile($profile)) {
                            throw new \Exception("Invalid profile: $profile");
                        }
                Severity: Minor
                Found in src/StackFormation/Profile/YamlCredentialProvider.php - About 1 hr to fix

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

                                  case 'CREATE_FAILED':
                                      if ($questionHelper->ask($input, $output, new ConfirmationQuestion('Stack is in CREATE_FAILED state. Do you want to delete it first? [Y/n]'))) {
                                          $output->writeln('Deleting failed stack ' . $stackName);
                                          $stack->delete();
                                          $observer = new Observer($stack, $stackFactory, $output);
                  Severity: Major
                  Found in src/StackFormation/Command/Blueprint/DeployCommand.php and 2 other locations - About 1 hr to fix
                  src/StackFormation/Command/Blueprint/DeployCommand.php on lines 174..184
                  src/StackFormation/Command/Blueprint/DeployCommand.php on lines 185..195

                  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 107.

                  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 3 locations. Consider refactoring.
                  Open

                                  case 'UPDATE_IN_PROGRESS':
                                      if ($questionHelper->ask($input, $output, new ConfirmationQuestion('Stack is in UPDATE_IN_PROGRESS state. Do you want to cancel the current update and deploy then? [Y/n]'))) {
                                          $output->writeln('Cancelling update for ' . $stackName);
                                          $stack->cancelUpdate();
                                          $observer = new Observer($stack, $stackFactory, $output);
                  Severity: Major
                  Found in src/StackFormation/Command/Blueprint/DeployCommand.php and 2 other locations - About 1 hr to fix
                  src/StackFormation/Command/Blueprint/DeployCommand.php on lines 153..163
                  src/StackFormation/Command/Blueprint/DeployCommand.php on lines 185..195

                  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 107.

                  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 3 locations. Consider refactoring.
                  Open

                                  case 'UPDATE_ROLLBACK_FAILED':
                                      if ($questionHelper->ask($input, $output, new ConfirmationQuestion('Stack is in UPDATE_ROLLBACK_FAILED state. Do you want to continue the update rollback and deploy then? [Y/n]'))) {
                                          $output->writeln('Continuing update rollback for ' . $stackName);
                                          $stack->continueUpdateRollback();
                                          $observer = new Observer($stack, $stackFactory, $output);
                  Severity: Major
                  Found in src/StackFormation/Command/Blueprint/DeployCommand.php and 2 other locations - About 1 hr to fix
                  src/StackFormation/Command/Blueprint/DeployCommand.php on lines 153..163
                  src/StackFormation/Command/Blueprint/DeployCommand.php on lines 174..184

                  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 107.

                  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 interactAskForBlueprint has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function interactAskForBlueprint(InputInterface $input, OutputInterface $output)
                      {
                          $blueprint = $input->getArgument('blueprint');
                          if (empty($blueprint) || strpos($blueprint, '*') !== false || strpos($blueprint, '?') !== false) {
                  
                  
                  Severity: Minor
                  Found in src/StackFormation/Command/AbstractCommand.php - About 1 hr to fix

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

                        protected function execute(InputInterface $input, OutputInterface $output)
                        {
                            // TODO: refactor this to use \AwsInspector\Model\CloudWatchLogs\Repository
                    
                            $days = $input->getArgument('days');
                    Severity: Minor
                    Found in src/AwsInspector/Command/CloudwatchLogs/SetRetentionCommand.php - About 1 hr to fix

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

                          public function getStacksFromApi($fresh=false, $nameFilter=null, $statusFilter=null)
                          {
                              if ($fresh || is_null($this->stacksCache)) {
                                  $this->stacksCache = [];
                                  $nextToken = '';
                      Severity: Minor
                      Found in src/StackFormation/StackFactory.php - About 1 hr to fix

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

                            public function getEnvVarsForProfile($profile) {
                                $envVars = [];
                                if (!$this->isValidProfile($profile)) {
                                    throw new \Exception("Invalid profile: $profile");
                                }
                        Severity: Minor
                        Found in src/StackFormation/Profile/YamlCredentialProvider.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 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function execute(InputInterface $input, OutputInterface $output)
                            {
                                Registry::set('output', $output);
                        
                                $instance = $input->getArgument('instance');
                        Severity: Minor
                        Found in src/AwsInspector/Command/Ec2/SshCommand.php - About 1 hr to fix

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

                              protected function execute(InputInterface $input, OutputInterface $output)
                              {
                                  $groupPattern = $input->getArgument('group');
                                  if (empty($groupPattern)) {
                                      $groupPattern = '.*';
                          Severity: Minor
                          Found in src/AwsInspector/Command/CloudwatchLogs/ShowLogGroupsCommand.php - About 1 hr to fix

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

                                protected function execute(InputInterface $input, OutputInterface $output)
                                {
                            
                                    $iam = new \AwsInspector\Model\Iam\Repository();
                                    $accountId = $iam->findCurrentUser()->getAccountId();
                            Severity: Minor
                            Found in src/AwsInspector/Command/Clean/CleanSnapshotsCommand.php - About 1 hr to fix

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

                                  public function doRequest() {
                                      $this->responseHeaders = [];
                                      $this->responseBody = [];
                              
                                      $command = $this->getCurlCommand();
                              Severity: Minor
                              Found in src/AwsInspector/Helper/Curl.php - About 1 hr to fix

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

                                    private function getHttpHandler()
                                    {
                                        $guzzleStack = \GuzzleHttp\HandlerStack::create();
                                
                                        $guzzleStack->push(\GuzzleHttp\Middleware::retry(
                                Severity: Minor
                                Found in src/StackFormation/Profile/Manager.php - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language