Showing 90 of 102 total issues
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 {
- Read upRead up
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);
- Read upRead up
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 = [];
Method configure
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function configure()
{
$this
->setName('blueprint:deploy')
->setAliases(['deploy'])
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');
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) {
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');
- Read upRead up
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);
- Read upRead up
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 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();
- Read upRead up
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)
Method getPreprocessedTemplate
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getPreprocessedTemplate($force = false)
{
// Gather dependencies and create blueprint references
$this->getStackName();
$this->getProfile();
Method configure
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function configure()
{
$this
->setName('ec2:ssh')
->setAliases(['ssh'])
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');
}
Method execute
has 38 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');
Method getDetailedLogFromResourceStatusReason
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getDetailedLogFromResourceStatusReason($resourceStatusReason)
{
$logMessages = [];
if (preg_match('/See the details in CloudWatch Log Stream: (.*)/', $resourceStatusReason, $matches)) {
$logStream = $matches[1];
Method execute
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$tags = $input->getOption('tag');
$tags = $this->convertTags($tags);
Method interact
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function interact(InputInterface $input, OutputInterface $output)
{
$logGroupName = $input->getArgument('group') ?: '*';
$repository = new Repository();
Method getEnvVarsForProfile
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getEnvVarsForProfile($profile) {
$envVars = [];
if (!$this->isValidProfile($profile)) {
throw new \Exception("Invalid profile: $profile");
}
Method findCloudWatchLogGroupByStream
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function findCloudWatchLogGroupByStream($stream, $logGroupNamePrefix = null)
{
return null; // TODO: FIx this!
Method execute
has 33 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
$days = $input->getArgument('days');