AOEpeople/StackFormation

View on GitHub

Showing 90 of 102 total issues

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

    public function findByStackname($stackname)
    {
        foreach ($this->config->getBlueprintNames() as $blueprintName) {
            if (strpos($blueprintName, '{env:') !== false) {
                $regex = preg_replace('/\{env:([^:\}\{]+?)\}/', '(?P<$1>\w+)', $blueprintName);
Severity: Minor
Found in src/StackFormation/BlueprintFactory.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 getBlueprintLabels has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function getBlueprintLabels($filter=null)
    {
        $labels = [];
        foreach ($this->config->getBlueprintNames() as $blueprintName) {
            try {
Severity: Minor
Found in src/StackFormation/BlueprintFactory.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 getParameters has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getParameters($resolvePlaceholders = true)
    {
        $this->applyEnvVars();

        $parameters = [];
Severity: Minor
Found in src/StackFormation/Blueprint.php - About 1 hr to fix

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

        protected function configure()
        {
            $this
                ->setName('blueprint:deploy')
                ->setAliases(['deploy'])
    Severity: Minor
    Found in src/StackFormation/Command/Blueprint/DeployCommand.php - About 1 hr to fix

      Method execute has 46 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');
      Severity: Minor
      Found in src/AwsInspector/Command/CloudwatchLogs/AddLambdaTriggerCommand.php - About 1 hr to fix

        Method injectFilecontent has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function injectFilecontent($jsonString, $basePath)
            {
                $jsonString = preg_replace_callback(
                    '/(\s*)(.*){\s*"Fn::FileContent(Unpretty|TrimLines|Minify)?"\s*:\s*"(.+?)"\s*}/',
                    function (array $matches) use ($basePath) {
        Severity: Minor
        Found in src/StackFormation/Preprocessor.php - About 1 hr to fix

          Function getPreprocessedTemplate has a Cognitive Complexity of 14 (exceeds 5 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

          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 14 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function execute(InputInterface $input, OutputInterface $output)
              {
                  $nameFilter = $input->getOption('nameFilter');
                  $stacks = $this->getStackFactory()->getStacksFromApi(false, $nameFilter);
          
          
          Severity: Minor
          Found in src/StackFormation/Command/Stack/CompareAllCommand.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 14 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function execute(InputInterface $input, OutputInterface $output)
              {
                  // TODO: refactor this to use \AwsInspector\Model\CloudWatchLogs\Repository
          
                  $groupPattern = $input->getArgument('group');
          Severity: Minor
          Found in src/AwsInspector/Command/CloudwatchLogs/AddLambdaTriggerCommand.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 interact has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function interact(InputInterface $input, OutputInterface $output)
              {
                  $instance = $input->getArgument('instance');
                  if (empty($instance)) {
                      // find instances based on tag(s)
          Severity: Minor
          Found in src/AwsInspector/Command/Ec2/SshCommand.php - About 1 hr to fix

            Method compare has 39 lines of code (exceeds 25 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

              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

                              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
                                Severity
                                Category
                                Status
                                Source
                                Language