Showing 143 of 189 total issues
Function parse
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function parse(string $source): void
{
$comment = '';
$params = '';
- 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 run
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run(array $tasks, array $hosts, ?Planner $plan = null): int
{
$globalLimit = (int) $this->input->getOption('limit') ?: count($hosts);
foreach ($tasks as $task) {
Function collect
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public static function collect(InputInterface $input, OutputInterface $output): array
{
$arguments = [];
foreach ($input->getOptions() as $name => $value) {
if (!$input->getOption($name)) {
- 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 runTask
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function runTask(Task $task, array $hosts): int
{
if (getenv('DEPLOYER_LOCAL_WORKER') === 'true') {
// This allows to code coverage all recipe,
// as well as speedup tests by not spawning
Function createTreeFromTaskName
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
private function createTreeFromTaskName(string $taskName, string $postfix = '', bool $isLast = false)
{
$task = $this->deployer->tasks->get($taskName);
if (!$task->isEnabled()) {
- 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 getTasks
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function getTasks(string $name, ?string $startFrom = null, array &$skipped = []): array
{
$tasks = [];
$this->visitedTasks = [];
$allTasks = $this->doGetTasks($name);
- 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 handValue
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static function handValue(array $hand): int
{
$aces = 0;
$value = 0;
foreach ($hand as [$rank]) {
- 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 colorize_host
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function colorize_host(string $alias): string
{
if (defined('NO_ANSI')) {
return $alias;
}
- 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 doGetTasks
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function doGetTasks(string $name): array
{
if (array_key_exists($name, $this->visitedTasks)) {
if ($this->visitedTasks[$name] >= 100) {
throw new Exception("Looks like a circular dependency with \"$name\" task.");
- 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 run
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function run(Host $host, string $command, array $config = []): string
{
$defaults = [
'timeout' => $host->get('default_timeout', 300),
'idle_timeout' => null,
File Deployer.php
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
declare(strict_types=1);
/* (c) Anton Medvedev <anton@medv.io>
Method handValue
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function handValue(array $hand): int
{
$aces = 0;
$value = 0;
foreach ($hand as [$rank]) {
Method execute
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(Input $input, Output $output): int
{
$this->deployer->input = $input;
$this->deployer->output = $output;
$this->deployer['log'] = $input->getOption('log');
Function execute
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->telemetry();
$hostname = $input->getArgument('hostname');
if (!empty($hostname)) {
- 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 run
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public static function run(string $version, ?string $deployFile): void
{
if (str_contains($version, 'master')) {
// Get version from composer.lock
$lockFile = __DIR__ . '/../../../../composer.lock';
- 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 renderException
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function renderException(Throwable $exception, Host $host): void
{
if ($exception instanceof RunException) {
$message = "";
Method run
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function run(string $command, ?array $options = [], ?int $timeout = null, ?int $idle_timeout = null, ?string $secret = null, ?array $env = null, ?bool $real_time_output = false, ?bool $no_throw = false): string
{
$namedArguments = [];
foreach (['timeout', 'idle_timeout', 'secret', 'env', 'real_time_output', 'no_throw'] as $arg) {
if ($$arg !== null) {
Function run
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function run(string $command, ?array $options = [], ?int $timeout = null, ?int $idle_timeout = null, ?string $secret = null, ?array $env = null, ?bool $real_time_output = false, ?bool $no_throw = false): string
{
$namedArguments = [];
foreach (['timeout', 'idle_timeout', 'secret', 'env', 'real_time_output', 'no_throw'] as $arg) {
if ($$arg !== null) {
- 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 array_merge_alternate
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function array_merge_alternate(array $original, array $override): array
{
foreach ($override as $key => $value) {
if (isset($original[$key])) {
if (!is_array($original[$key])) {
- 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 apply
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public static function apply(?array $conditions, Host $host): bool
{
if (empty($conditions)) {
return true;
}
- 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"