AOEpeople/StackFormation

View on GitHub

Showing 102 of 102 total issues

Method validateTags has 28 lines of code (exceeds 25 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 1 hr to fix

    Function deploy has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function deploy($dryRun=false, $force=false)
        {
            $arguments = $this->prepareArguments($force);
    
            if (!$dryRun) {
    Severity: Minor
    Found in src/StackFormation/BlueprintAction.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 findCloudWatchLogGroupByStream has a Cognitive Complexity of 10 (exceeds 5 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

    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 getDetailedLogFromResourceStatusReason has a Cognitive Complexity of 10 (exceeds 5 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

    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 findDependantsForStack has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function findDependantsForStack($stackName)
        {
            $dependants = [];
            foreach ($this->stacks as $type => $typeData) {
                if (isset($typeData[$stackName])) {
    Severity: Minor
    Found in src/StackFormation/DependencyTracker.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 getStackDependenciesAsFlatList has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getStackDependenciesAsFlatList()
        {
            $rows = [];
            foreach ($this->stacks as $type => $typeData) {
                foreach ($typeData as $stackName => $stackData) {
    Severity: Minor
    Found in src/StackFormation/DependencyTracker.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 compare has a Cognitive Complexity of 10 (exceeds 5 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

    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 getEnvDependenciesAsFlatList has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getEnvDependenciesAsFlatList()
        {
            $rows = [];
            foreach ($this->envVars as $type => $typeData) {
                foreach ($typeData as $envVar => $tmp) {
    Severity: Minor
    Found in src/StackFormation/DependencyTracker.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 10 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function execute(InputInterface $input, OutputInterface $output)
        {
            // TODO: refactor this to use \AwsInspector\Model\CloudWatchLogs\Repository
    
            $days = $input->getArgument('days');
    Severity: Minor
    Found in src/AwsInspector/Command/CloudwatchLogs/SetRetentionCommand.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 __construct has 27 lines of code (exceeds 25 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 1 hr to fix

      Method hasAccess has 26 lines of code (exceeds 25 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 1 hr to fix

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

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

            public function doRequest() {
                $this->responseHeaders = [];
                $this->responseBody = [];
        
                $command = $this->getCurlCommand();
        Severity: Minor
        Found in src/AwsInspector/Helper/Curl.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 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 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 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 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

          Severity
          Category
          Status
          Source
          Language