AOEpeople/StackFormation

View on GitHub

Showing 90 of 102 total issues

Function executeWithBlueprint has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

    protected function executeWithBlueprint(Blueprint $blueprint, InputInterface $input, OutputInterface $output)
    {
        $dryRun = $input->getOption('dryrun');
        if ($dryRun) {
            $formatter = new \Symfony\Component\Console\Helper\FormatterHelper();
Severity: Minor
Found in src/StackFormation/Command/Blueprint/DeployCommand.php - About 7 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 merge has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

    public function merge(array $templates, $description = null, array $additionalData = [])
    {
        if (count($templates) == 0) {
            throw new \InvalidArgumentException('No templates given');
        }
Severity: Minor
Found in src/StackFormation/TemplateMerger.php - About 5 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 hasAccess has a Cognitive Complexity of 33 (exceeds 5 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 4 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 executeWithBlueprint has 122 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function executeWithBlueprint(Blueprint $blueprint, InputInterface $input, OutputInterface $output)
    {
        $dryRun = $input->getOption('dryrun');
        if ($dryRun) {
            $formatter = new \Symfony\Component\Console\Helper\FormatterHelper();
Severity: Major
Found in src/StackFormation/Command/Blueprint/DeployCommand.php - About 4 hrs to fix

    Function interact has a Cognitive Complexity of 31 (exceeds 5 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 4 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 interact has a Cognitive Complexity of 28 (exceeds 5 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 4 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 getParameters has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getParameters($resolvePlaceholders = true)
        {
            $this->applyEnvVars();
    
            $parameters = [];
    Severity: Minor
    Found in src/StackFormation/Blueprint.php - About 3 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 executeWithStack has 88 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function executeWithStack(Stack $stack, InputInterface $input, OutputInterface $output)
        {
            $events = $stack->getEvents();
    
            $groups = [];
    Severity: Major
    Found in src/StackFormation/Command/Stack/TimelineCommand.php - About 3 hrs to fix

      Function executeWithStack has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function executeWithStack(Stack $stack, InputInterface $input, OutputInterface $output)
          {
              $events = $stack->getEvents();
      
              $groups = [];
      Severity: Minor
      Found in src/StackFormation/Command/Stack/TimelineCommand.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 getConfigTreeBuilder has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getConfigTreeBuilder()
          {
              $treeBuilder = new TreeBuilder();
              $rootNode = $treeBuilder->root('root');
              $rootNode
      Severity: Major
      Found in src/StackFormation/ConfigTreeBuilder.php - About 2 hrs to fix

        Function getStacksFromApi has a Cognitive Complexity of 19 (exceeds 5 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 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 execute has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function execute(InputInterface $input, OutputInterface $output)
            {
                $nameFilter = $input->getOption('nameFilter');
                $stacks = $this->getStackFactory()->getStacksFromApi(false, $nameFilter);
        
        
        Severity: Major
        Found in src/StackFormation/Command/Stack/CompareAllCommand.php - About 2 hrs to fix

          Method merge has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function merge(array $templates, $description = null, array $additionalData = [])
              {
                  if (count($templates) == 0) {
                      throw new \InvalidArgumentException('No templates given');
                  }
          Severity: Major
          Found in src/StackFormation/TemplateMerger.php - About 2 hrs to fix

            Stack has 21 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Stack {
            
                CONST METADATA_KEY = 'StackFormation';
                CONST METADATA_KEY_BLUEPRINT = 'Blueprint';
                CONST METADATA_KEY_ENVVARS = 'EnvironmentVariables';
            Severity: Minor
            Found in src/StackFormation/Stack.php - About 2 hrs to fix

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

              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

              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

                Severity
                Category
                Status
                Source
                Language