AOEpeople/StackFormation

View on GitHub

Showing 90 of 102 total issues

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 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)
            {
        
                $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

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

                    public static function validateTags(array $tags)
                    {
                        // @see http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html#tag-restrictions
                        if (count($tags) > 10) {
                            throw new \Exception('No more than 10 tags are allowed');
                Severity: Minor
                Found in src/StackFormation/Helper/Validator.php - About 1 hr to fix

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

                      public function getStackDependenciesAsFlatList()
                      {
                          $rows = [];
                          foreach ($this->stacks as $type => $typeData) {
                              foreach ($typeData as $stackName => $stackData) {
                  Severity: Minor
                  Found in src/StackFormation/DependencyTracker.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 compare has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function compare()
                      {
                          if (empty($this->stack)) {
                              throw new \InvalidArgumentException('Stack not set');
                          }
                  Severity: Minor
                  Found in src/StackFormation/Diff.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 getDetailedLogFromResourceStatusReason has a Cognitive Complexity of 10 (exceeds 5 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

                  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 findDependantsForStack has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function findDependantsForStack($stackName)
                      {
                          $dependants = [];
                          foreach ($this->stacks as $type => $typeData) {
                              if (isset($typeData[$stackName])) {
                  Severity: Minor
                  Found in src/StackFormation/DependencyTracker.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 execute has a Cognitive Complexity of 10 (exceeds 5 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

                  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 getEnvDependenciesAsFlatList has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getEnvDependenciesAsFlatList()
                      {
                          $rows = [];
                          foreach ($this->envVars as $type => $typeData) {
                              foreach ($typeData as $envVar => $tmp) {
                  Severity: Minor
                  Found in src/StackFormation/DependencyTracker.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 findCloudWatchLogGroupByStream has a Cognitive Complexity of 10 (exceeds 5 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

                  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 deploy has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function deploy($dryRun=false, $force=false)
                      {
                          $arguments = $this->prepareArguments($force);
                  
                          if (!$dryRun) {
                  Severity: Minor
                  Found in src/StackFormation/BlueprintAction.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 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function __construct(array $files=null)
                      {
                          $files = is_null($files) ? $this->findAllConfigurationFiles() : $files;
                          if (count($files) == 0) {
                              throw new \StackFormation\Exception\NoBlueprintsFoundException("Could not find any blueprints.yml configuration files");
                  Severity: Minor
                  Found in src/StackFormation/Config.php - About 1 hr to fix

                    Method hasAccess has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function hasAccess($origin, $port, $protocol='tcp') {
                            foreach ($this->getIpPermissions() as $permission) {
                                if ($permission['IpProtocol'] != $protocol || $permission['FromPort'] != $port) {
                                    continue;
                                }
                    Severity: Minor
                    Found in src/AwsInspector/Model/SecurityGroup/SecurityGroup.php - About 1 hr to fix

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

                          public function doRequest() {
                              $this->responseHeaders = [];
                              $this->responseBody = [];
                      
                              $command = $this->getCurlCommand();
                      Severity: Minor
                      Found in src/AwsInspector/Helper/Curl.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

                      Severity
                      Category
                      Status
                      Source
                      Language