aboutsummaryrefslogtreecommitdiffstats
path: root/core/Command/App
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
commitcaff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch)
tree186d494c2aea5dea7255d3584ef5d595fc6e6194 /core/Command/App
parentedf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff)
downloadnextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz
nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core/Command/App')
-rw-r--r--core/Command/App/CheckCode.php15
-rw-r--r--core/Command/App/Install.php5
-rw-r--r--core/Command/App/ListApps.php4
-rw-r--r--core/Command/App/Remove.php6
-rw-r--r--core/Command/App/Update.php5
5 files changed, 16 insertions, 19 deletions
diff --git a/core/Command/App/CheckCode.php b/core/Command/App/CheckCode.php
index d37211d3add..185ec0e64a3 100644
--- a/core/Command/App/CheckCode.php
+++ b/core/Command/App/CheckCode.php
@@ -42,8 +42,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
-class CheckCode extends Command implements CompletionAwareInterface {
-
+class CheckCode extends Command implements CompletionAwareInterface {
protected $checkers = [
'private' => PrivateCheck::class,
'deprecation' => DeprecationCheck::class,
@@ -95,7 +94,7 @@ class CheckCode extends Command implements CompletionAwareInterface {
$codeChecker = new CodeChecker($checkList, !$input->getOption('skip-validate-info'));
$codeChecker->listen('CodeChecker', 'analyseFileBegin', function ($params) use ($output) {
- if(OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
+ if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
$output->writeln("<info>Analysing {$params}</info>");
}
});
@@ -103,29 +102,29 @@ class CheckCode extends Command implements CompletionAwareInterface {
$count = count($errors);
// show filename if the verbosity is low, but there are errors in a file
- if($count > 0 && OutputInterface::VERBOSITY_VERBOSE > $output->getVerbosity()) {
+ if ($count > 0 && OutputInterface::VERBOSITY_VERBOSE > $output->getVerbosity()) {
$output->writeln("<info>Analysing {$filename}</info>");
}
// show error count if there are errors present or the verbosity is high
- if($count > 0 || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
+ if ($count > 0 || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
$output->writeln(" {$count} errors");
}
usort($errors, function ($a, $b) {
return $a['line'] >$b['line'];
});
- foreach($errors as $p) {
+ foreach ($errors as $p) {
$line = sprintf("%' 4d", $p['line']);
$output->writeln(" <error>line $line: {$p['disallowedToken']} - {$p['reason']}</error>");
}
});
$errors = [];
- if(!$input->getOption('skip-checkers')) {
+ if (!$input->getOption('skip-checkers')) {
$errors = $codeChecker->analyse($appId);
}
- if(!$input->getOption('skip-validate-info')) {
+ if (!$input->getOption('skip-validate-info')) {
$infoChecker = new InfoChecker();
$infoChecker->listen('InfoChecker', 'parseError', function ($error) use ($output) {
$output->writeln("<error>Invalid appinfo.xml file found: $error</error>");
diff --git a/core/Command/App/Install.php b/core/Command/App/Install.php
index 7248ec1e425..49f4f0b804e 100644
--- a/core/Command/App/Install.php
+++ b/core/Command/App/Install.php
@@ -32,7 +32,6 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class Install extends Command {
-
protected function configure() {
$this
->setName('app:install')
@@ -64,12 +63,12 @@ class Install extends Command {
$installer = \OC::$server->query(Installer::class);
$installer->downloadApp($appId);
$result = $installer->installApp($appId);
- } catch(\Exception $e) {
+ } catch (\Exception $e) {
$output->writeln('Error: ' . $e->getMessage());
return 1;
}
- if($result === false) {
+ if ($result === false) {
$output->writeln($appId . ' couldn\'t be installed');
return 1;
}
diff --git a/core/Command/App/ListApps.php b/core/Command/App/ListApps.php
index 84fdf7f8f41..0765ab39a24 100644
--- a/core/Command/App/ListApps.php
+++ b/core/Command/App/ListApps.php
@@ -62,7 +62,7 @@ class ListApps extends Base {
}
protected function execute(InputInterface $input, OutputInterface $output) {
- if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false'){
+ if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false') {
$shippedFilter = $input->getOption('shipped') === 'true';
} else {
$shippedFilter = null;
@@ -74,7 +74,7 @@ class ListApps extends Base {
//sort enabled apps above disabled apps
foreach ($apps as $app) {
- if ($shippedFilter !== null && $this->manager->isShipped($app) !== $shippedFilter){
+ if ($shippedFilter !== null && $this->manager->isShipped($app) !== $shippedFilter) {
continue;
}
if ($this->manager->isInstalled($app)) {
diff --git a/core/Command/App/Remove.php b/core/Command/App/Remove.php
index bb264e77e5f..d3e91332d77 100644
--- a/core/Command/App/Remove.php
+++ b/core/Command/App/Remove.php
@@ -96,7 +96,7 @@ class Remove extends Command implements CompletionAwareInterface {
try {
$this->manager->disableApp($appId);
$output->writeln($appId . ' disabled');
- } catch(Throwable $e) {
+ } catch (Throwable $e) {
$output->writeln('<error>Error: ' . $e->getMessage() . '</error>');
$this->logger->logException($e, [
'app' => 'CLI',
@@ -109,7 +109,7 @@ class Remove extends Command implements CompletionAwareInterface {
// Let's try to remove the app...
try {
$result = $this->installer->removeApp($appId);
- } catch(Throwable $e) {
+ } catch (Throwable $e) {
$output->writeln('<error>Error: ' . $e->getMessage() . '</error>');
$this->logger->logException($e, [
'app' => 'CLI',
@@ -118,7 +118,7 @@ class Remove extends Command implements CompletionAwareInterface {
return 1;
}
- if($result === false) {
+ if ($result === false) {
$output->writeln($appId . ' could not be removed');
return 1;
}
diff --git a/core/Command/App/Update.php b/core/Command/App/Update.php
index 4be2f4639ef..417d1915d05 100644
--- a/core/Command/App/Update.php
+++ b/core/Command/App/Update.php
@@ -91,7 +91,6 @@ class Update extends Command {
$output->writeln($singleAppId . ' not installed');
return 1;
}
-
} elseif ($input->getOption('all') || $input->getOption('showonly')) {
$apps = \OC_App::getAllApps();
} else {
@@ -108,7 +107,7 @@ class Update extends Command {
if (!$input->getOption('showonly')) {
try {
$result = $this->installer->updateAppstoreApp($appId);
- } catch(\Exception $e) {
+ } catch (\Exception $e) {
$this->logger->logException($e, ['message' => 'Failure during update of app "' . $appId . '"','app' => 'app:update']);
$output->writeln('Error: ' . $e->getMessage());
$return = 1;
@@ -117,7 +116,7 @@ class Update extends Command {
if ($result === false) {
$output->writeln($appId . ' couldn\'t be updated');
$return = 1;
- } elseif($result === true) {
+ } elseif ($result === true) {
$output->writeln($appId . ' updated');
}
}