AOEpeople/StackFormation

View on GitHub

Showing 102 of 102 total issues

Function interactAskForBlueprint has a Cognitive Complexity of 16 (exceeds 5 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 2 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

Function __construct has a Cognitive Complexity of 16 (exceeds 5 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 2 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

Function validateTags has a Cognitive Complexity of 16 (exceeds 5 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 2 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

Function getDecodedJson has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function getDecodedJson()
    {
        if ($this->prefix) {
            if (!$this->cache->has(__METHOD__)) {
                $array = parent::getDecodedJson();
Severity: Minor
Found in src/StackFormation/PrefixedTemplate.php - About 2 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 interact has 50 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/TerminateCommand.php - About 2 hrs to fix

    Function execute has a Cognitive Complexity of 15 (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');

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

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

      <?php
      
      namespace StackFormation\ValueResolver\Stage;
      
      use StackFormation\Helper;
      Severity: Major
      Found in src/StackFormation/ValueResolver/Stage/StackOutput.php and 2 other locations - About 1 hr to fix
      src/StackFormation/ValueResolver/Stage/StackParameter.php on lines 1..23
      src/StackFormation/ValueResolver/Stage/StackResource.php on lines 1..23

      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

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

      <?php
      
      namespace StackFormation\ValueResolver\Stage;
      
      use StackFormation\Helper;
      Severity: Major
      Found in src/StackFormation/ValueResolver/Stage/StackParameter.php and 2 other locations - About 1 hr to fix
      src/StackFormation/ValueResolver/Stage/StackOutput.php on lines 1..23
      src/StackFormation/ValueResolver/Stage/StackResource.php on lines 1..23

      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

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

      <?php
      
      namespace StackFormation\ValueResolver\Stage;
      
      use StackFormation\Helper;
      Severity: Major
      Found in src/StackFormation/ValueResolver/Stage/StackResource.php and 2 other locations - About 1 hr to fix
      src/StackFormation/ValueResolver/Stage/StackOutput.php on lines 1..23
      src/StackFormation/ValueResolver/Stage/StackParameter.php on lines 1..23

      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

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