Showing 2,255 of 2,255 total issues
Method postInstall
has 36 lines of code (exceeds 25 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)
Method getDetails
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function getDetails($instance)
{
$archives = $instance->getArchives();
if (count($archives) > 0) {
Method cleanup
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function cleanup($instanceId, $instanceName, $maxBackups = 0)
{
$backup_directory = "{$instanceId}-{$instanceName}";
$files = glob($_ENV['ARCHIVE_FOLDER'] . "/$backup_directory" . '/*.tar.bz2');
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (empty($email) || ! filter_var($email, FILTER_VALIDATE_EMAIL)) {
$question = CommandHelper::getQuestion('Email address to contact');
$question->setValidator(function ($value) {
if (! filter_var($value, FILTER_VALIDATE_EMAIL)) {
throw new \RuntimeException('Please insert a valid email address.');
- 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 109.
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
if (empty($email) || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
$question = CommandHelper::getQuestion('Email address to contact');
$question->setValidator(function ($value) {
if (!filter_var($value, FILTER_VALIDATE_EMAIL)) {
throw new \RuntimeException('Please insert a valid email address.');
- 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 109.
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
Function execute
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$instances = CommandHelper::getInstances('tiki');
$instancesInfo = CommandHelper::getInstancesInfo($instances);
$package = $input->getOption('package');
- 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 getInterpreterPath
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function getInterpreterPath(TikiRequirements $requirements = null)
{
$instance = $this->instance;
$detectedBinaries = $instance->phpexec ? [$instance->phpexec] : $instance->getDiscovery()->detectPHP();
- 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 fixPermissions
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function fixPermissions($path)
{
$filesystem = new Filesystem();
$perm = $this->getFilePerm();
$user = $this->getFileUser();
- 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 readSystemIniConfigFileFromManifest
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function readSystemIniConfigFileFromManifest($manifest_file)
{
$result = [];
$access = $this->getAccess();
$manifest = $access->fileGetContents($manifest_file);
- 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 update
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function update(string $targetFolder, string $branch, int $lag = 0, ?string $revision = null)
{
$commitSHA = $revision;
$fetchOptions = [];
$time = time() - $lag * 60 * 60 * 24;
- 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 execute
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$updater = UpdateManager::getUpdater();
$updater->setLogger($this->logger);
Method execute
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function execute(InputInterface $input, OutputInterface $output)
{
$instances = CommandHelper::getInstances();
$instancesInfo = CommandHelper::getInstancesInfo($instances);
if (isset($instancesInfo)) {
Method getUpgradeVersion
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function getUpgradeVersion(Instance $instance, bool $onlySupported, string $branch = null, Version $curVersion = null): ?Version
{
$curVersion = $curVersion ?: $instance->getLatestVersion();
if ($instance->getApplication()) {
$versions = $instance->getApplication()->getUpgradableVersions($curVersion, $onlySupported);
Similar blocks of code found in 2 locations. Consider refactoring. Open
foreach (explode("\n", `svn ls $this->repositoryUrl/tags`) as $line) {
$line = trim($line);
if (empty($line)) {
continue;
}
- 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 108.
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 2 locations. Consider refactoring. Open
foreach (explode("\n", `svn ls $this->repositoryUrl/branches`) as $line) {
$line = trim($line);
if (empty($line)) {
continue;
}
- 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 108.
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 configure
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function configure()
{
parent::configure();
$this
Method interact
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function interact(InputInterface $input, OutputInterface $output)
{
$instances = CommandHelper::getInstances('tiki');
if (empty($input->getOption('patch'))) {
Method create
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create($skipArchive = false, $backupDir = null)
{
$backupDir = $backupDir ?: $this->backupDir;
$this->io->writeln('Checking directories...');
Method configure
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function configure()
{
$this
->setName('instance:checkout')
->setDescription('Checkout a different branch or revision on an underlying Git controlled source.')
Method readSystemIniConfigFileFromManifest
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function readSystemIniConfigFileFromManifest($manifest_file)
{
$result = [];
$access = $this->getAccess();
$manifest = $access->fileGetContents($manifest_file);