Showing 2,255 of 2,255 total issues
Method copyDirectories
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function copyDirectories($targets, $backupDir)
{
$access = $this->getAccess();
$backupDir = $backupDir ?: $this->backupDir;
$result = [];
Method rsync
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function rsync($args = [])
{
$return_val = -1;
if (empty($args['src']) || empty($args['dest'])) {
return $return_val;
Function interact
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function interact(InputInterface $input, OutputInterface $output)
{
$instances = CommandHelper::getInstances('tiki');
$instances = array_filter($instances, function ($instance) {
return $instance->vcs_type == 'git';
- 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 getLocalCheckouts
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function getLocalCheckouts()
{
$access = $this->instance->getBestAccess('scripting');
$access->chdir($this->instance->webroot);
$adjustedFindCmd = $access->executeWithPriorityParams('find');
- 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 getPassword
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
function getPassword($stars = false)
{
// Get current style
$oldStyle = shell_exec('stty -g');
- 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 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function interact(InputInterface $input, OutputInterface $output)
{
$this->io->note('Backups are only available on Local and SSH instances.');
$instances = CommandHelper::getInstances('all', true);
Method getInstancesInfo
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function getInstancesInfo(array $instances, bool $all_infos = false): ?array
{
$instancesInfo = null;
foreach ($instances as $instance) {
Method configure
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function configure()
{
parent::configure();
$this
Method configure
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function configure()
{
parent::configure();
$this
Method interact
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function interact(InputInterface $input, OutputInterface $output)
{
$instances = CommandHelper::getInstances('all', true);
$instancesInfo = CommandHelper::getInstancesInfo($instances);
Identical blocks of code found in 2 locations. Consider refactoring. Open
public function createCommand($bin, $args = [], $stdin = '')
{
$options = [];
if ($this->location) {
- 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 113.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
public function createCommand($bin, $args = [], $stdin = '')
{
$options = [];
if ($this->location) {
- 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 113.
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 getSVNPath
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getSVNPath()
{
$host = $this->getHost();
$sets = [
Method restoreDatabase
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function restoreDatabase(Database $database, string $remoteFile, bool $clone)
{
$tmp = tempnam($_ENV['TEMP_FOLDER'], 'dblocal');
if (! empty($database->dbLocalContent)) {
Function validateInstanceSelection
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static function validateInstanceSelection($answer, $allInstances)
{
if (empty($answer)) {
throw new \RuntimeException(
'You must select an instance #ID'
- 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 interact
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function interact(InputInterface $input, OutputInterface $output)
{
if (empty($input->getOption('instance'))) {
if (empty($this->instancesInfo)) {
- 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 setupDatabase
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function setupDatabase(Instance $instance, $reconfigure = false): Instance
{
try {
if (!$reconfigure && $this->testExistingDbConnection($instance)) {
return $instance;
- 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 detectPHPMacOS
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
protected function detectPHPMacOS($options = [], $searchOrder = null)
{
if ($searchOrder === null) {
$searchOrder = [
['command', ['-v', 'php']],
- 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 postInstall
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function postInstall(array $options = [])
{
$access = $this->instance->getBestAccess('scripting');
$access->getHost(); // trigger the config of the location change (to catch phpenv)
- 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 info
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function info($path, $args = [])
{
if (empty($args)) {
$args = $this->getDefaultArgs('info');
}
- 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"