AOEpeople/StackFormation

View on GitHub

Showing 90 of 102 total issues

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

    protected function flatternTree(array $treeIn)
    {
        $treeOut = [];
        foreach ($treeIn as $name => $children) {
            if (count($children) === 0) {
Severity: Minor
Found in src/StackFormation/Command/Stack/TreeCommand.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

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

    public function getDefaultUsername()
    {
        if (is_null($this->username)) {
            if ($user = $this->getInspectorConfiguration('user')) {
                $this->username = $user;
Severity: Minor
Found in src/AwsInspector/Model/Ec2/Instance.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

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

    protected function parametersAreEqual(array $paramA, array $paramB)
    {
        // skip password fields
        while (($passWordKeyInA = array_search('****', $paramA)) !== false) {
            unset($paramA[$passWordKeyInA]);
Severity: Minor
Found in src/StackFormation/Diff.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

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

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

    protected function __construct($privateKeyFile)
    {
        if (is_file($privateKeyFile)) {
            $this->privateKeyFile = $privateKeyFile;
        } else {
Severity: Minor
Found in src/AwsInspector/Ssh/PrivateKey.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

Method trackStackDependency has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function trackStackDependency($type, $stack, $resource, Blueprint $sourceBlueprint=null, $sourceType=null, $sourceKey=null)
Severity: Minor
Found in src/StackFormation/DependencyTracker.php - About 45 mins to fix

    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

    Method trackEnvUsage has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function trackEnvUsage($envVar, $withDefault=false, $value, Blueprint $sourceBlueprint=null, $sourceType=null, $sourceKey=null)
    Severity: Minor
    Found in src/StackFormation/DependencyTracker.php - About 45 mins to fix

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

          public function tunnel($configuration)
          {
              $configurationData = explode(':', $configuration);
      
              if (count($configurationData) == 4) {
      Severity: Minor
      Found in src/AwsInspector/Ssh/Connection.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 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 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 __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

          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

            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

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

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