Showing 202 of 202 total issues
Method printHand
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function printHand(array $hand, int $offset = 1)
{
$cards = [];
for ($i = 0; $i < count($hand) - $offset; $i++) {
list($rank) = $hand[$i];
Function parse
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function parse(string $expression): array
{
$all = [];
foreach (explode(',', $expression) as $sub) {
$conditions = [];
- 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 endTask
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function endTask(Task $task, bool $error = false): void
{
if (empty($this->startTime)) {
$this->startTime = round(microtime(true) * 1000);
}
- 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 complete
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void
{
parent::complete($input, $suggestions);
if ($input->mustSuggestArgumentValuesFor('selector')) {
$selectors = ['all'];
- 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 doGetTasks
has 31 lines of code (exceeds 25 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.");
Method task
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function task(string $name, $body = null): Task
{
$deployer = Deployer::get();
if (empty($body)) {
Similar blocks of code found in 3 locations. Consider refactoring. Open
task('teams:notify', function () {
if (!get('teams_webhook', false)) {
warning('No MS Teams webhook configured');
return;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 105.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
task('teams:notify:success', function () {
if (!get('teams_webhook', false)) {
warning('No MS Teams webhook configured');
return;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 105.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
task('teams:notify:failure', function () {
if (!get('teams_webhook', false)) {
warning('No MS Teams webhook configured');
return;
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 105.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method getTasks
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getTasks(string $name, ?string $startFrom = null, array &$skipped = []): array
{
$tasks = [];
$this->visitedTasks = [];
$allTasks = $this->doGetTasks($name);
Function recipes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function recipes(): array
{
$recipes = [];
$dir = new \DirectoryIterator(__DIR__ . '/../../recipe');
foreach ($dir as $fileinfo) {
- 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 copyTo
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function copyTo(string $file): void
{
if (null === $this->file) {
throw LogicException::create(
'The update file has not been downloaded.'
- 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 importComponents
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function importComponents(array $components): self
{
if (isset($components[Parser::BUILD])) {
$this->build = $components[Parser::BUILD];
} else {
- 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 on
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function on($hosts, callable $callback): void
{
if (!is_array($hosts) && !($hosts instanceof \Traversable)) {
$hosts = [$hosts];
}
- 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 runTask
has a Cognitive Complexity of 10 (exceeds 5 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
- 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 endTask
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function endTask(Task $task, bool $error = false): void
{
if (empty($this->startTime)) {
$this->startTime = round(microtime(true) * 1000);
}
Method importComponents
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function importComponents(array $components): self
{
if (isset($components[Parser::BUILD])) {
$this->build = $components[Parser::BUILD];
} else {
Method connectionOptionsArray
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function connectionOptionsArray(): array
{
$options = [];
if ($this->has('ssh_arguments')) {
foreach ($this->getSshArguments() as $arg) {
Method askChoice
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function askChoice(string $message, array $availableChoices, $default = null, bool $multiselect = false)
{
if (defined('DEPLOYER_NO_ASK')) {
throw new WillAskUser($message);
}
Method markdown
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function markdown(): string
{
$output = <<<MD
<!-- DO NOT EDIT THIS FILE! -->
<!-- Instead edit src/functions.php -->