AOEpeople/StackFormation

View on GitHub

Showing 102 of 102 total issues

Function execute has a Cognitive Complexity of 8 (exceeds 5 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 45 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

Function findDatabasesByTags has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function findDatabasesByTags(array $tags = array())
    {
        $databases = $this->findDatabases();
        $matchingDatabases = new Collection();
        foreach ($databases as $database) {
Severity: Minor
Found in src/AwsInspector/Model/Rds/Repository.php - About 45 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

Function validateElbParam has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function validateElbParam(array $loadBalancers) {
        $loadBalancerNames = [];
        foreach ($loadBalancers as $loadBalancer) {
            if (is_string($loadBalancer)) {
                $loadBalancerNames[] = $loadBalancer;
Severity: Minor
Found in src/AwsInspector/Model/AutoScaling/AutoScalingGroup.php - About 45 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

Method resolvePlaceholders has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function resolvePlaceholders($string, Blueprint $sourceBlueprint=null, $sourceType=null, $sourceKey=null, $circuitBreaker=0)
Severity: Minor
Found in src/StackFormation/ValueResolver/ValueResolver.php - About 35 mins to fix

    Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function __construct($value, Blueprint $sourceBlueprint=null, $sourceType=null, $sourceKey=null, \Exception $previous = null)
    Severity: Minor
    Found in src/StackFormation/Exception/ValueResolverException.php - About 35 mins to fix

      Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function __construct($username, $host, PrivateKey $privateKey = null, \AwsInspector\Model\Ec2\Instance $jumpHost = null, $multiplex=false)
      Severity: Minor
      Found in src/AwsInspector/Ssh/Connection.php - About 35 mins to fix

        Function getClient has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getClient($client, $profile=null, array $args=[]) {
                if (!is_string($client)) {
                    throw new \InvalidArgumentException('Client parameter must be a string');
                }
                if (getenv('AWS_UNSET_PROFILE')) {
        Severity: Minor
        Found in src/StackFormation/Profile/Manager.php - About 35 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

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

        Function prepareArguments has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function prepareArguments($force=false)
            {
                if ($this->output && !$this->output->isQuiet()) { $this->output->write("Preparing parameters... "); }
                $parameters = $this->blueprint->getParameters();
                if ($this->output && !$this->output->isQuiet()) { $this->output->writeln("done."); }
        Severity: Minor
        Found in src/StackFormation/BlueprintAction.php - About 35 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

        Function find has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function find($wildcardPatterns, array $choices)
            {
                if (!is_array($wildcardPatterns)) {
                    $wildcardPatterns = [$wildcardPatterns];
                }
        Severity: Minor
        Found in src/StackFormation/Helper/Finder.php - About 35 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

        Avoid too many return statements within this method.
        Open

                return $status;
        Severity: Major
        Found in src/StackFormation/Helper/Decorator.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return new \Aws\Handler\GuzzleV6\GuzzleHandler(new \GuzzleHttp\Client(['handler' => $guzzleStack]));
          Severity: Major
          Found in src/StackFormation/Profile/Manager.php - About 30 mins to fix

            Function getInspectorConfiguration has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function getInspectorConfiguration($type)
                {
                    $configString = $this->getTag('inspector') ? $this->getTag('inspector') : $this->getTag('inspector:jump');
                    if (!$configString) {
                        return false;
            Severity: Minor
            Found in src/AwsInspector/Model/Ec2/Instance.php - About 25 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

            Function parseHeader has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function parseHeader($line) {
                    $line = trim($line);
                    if (empty($line)) {
                        return;
                    }
            Severity: Minor
            Found in src/AwsInspector/Helper/Curl.php - About 25 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

            Function interactAskForStack has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function interactAskForStack(InputInterface $input, OutputInterface $output, $nameFilter=null, $statusFilter=null)
                {
                    $stack = $input->getArgument('stack');
                    if (empty($stack)) {
                        $choices = $this->getStacks($nameFilter, $statusFilter);
            Severity: Minor
            Found in src/StackFormation/Command/AbstractCommand.php - About 25 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

            Function validateProcessesParam has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function validateProcessesParam($processes) {
                    if (is_string($processes) && $processes == 'all') {
                        $processes = $this->availableProcesses;
                    }
            
            
            Severity: Minor
            Found in src/AwsInspector/Model/AutoScaling/AutoScalingGroup.php - About 25 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

            Function prepareTree has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function prepareTree(array $arr) {
                    $tree = [];
                    foreach ($arr as $a) {
                        $name = $a->getName();
                        $cur = &$tree;
            Severity: Minor
            Found in src/StackFormation/Command/Stack/TreeCommand.php - About 25 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

            Function executeScript has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function executeScript($script, $envVars=[], $type)
                {
                    if (empty($script)) {
                        return;
                    }
            Severity: Minor
            Found in src/StackFormation/BlueprintAction.php - About 25 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

            Function execute has a Cognitive Complexity of 6 (exceeds 5 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 25 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

            Function getSdk has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function getSdk()
                {
                    if (is_null($this->sdk)) {
                        $region = getenv('AWS_DEFAULT_REGION');
                        if (empty($region)) {
            Severity: Minor
            Found in src/StackFormation/Profile/Manager.php - About 25 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