summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-05-16 16:20:27 -0500
committerGitHub <noreply@github.com>2017-05-16 16:20:27 -0500
commit3a70ebfe0265da1c665def1ce97a50c9a62e9c8d (patch)
treee1e961c450c5e6c449fc719216aafcca21c41d03 /core
parentda9479735cb73dc1df3e08c87ce1e156a3f51b19 (diff)
parent6dea5e6aadc9611821d6f6c3949af56e9ca298f7 (diff)
downloadnextcloud-server-3a70ebfe0265da1c665def1ce97a50c9a62e9c8d.tar.gz
nextcloud-server-3a70ebfe0265da1c665def1ce97a50c9a62e9c8d.zip
Merge pull request #4767 from nextcloud/app-code-checker
Check language files and database schema with app code checker
Diffstat (limited to 'core')
-rw-r--r--core/Command/App/CheckCode.php34
1 files changed, 33 insertions, 1 deletions
diff --git a/core/Command/App/CheckCode.php b/core/Command/App/CheckCode.php
index aa618b26cec..46b9b748ada 100644
--- a/core/Command/App/CheckCode.php
+++ b/core/Command/App/CheckCode.php
@@ -26,8 +26,10 @@
namespace OC\Core\Command\App;
use OC\App\CodeChecker\CodeChecker;
+use OC\App\CodeChecker\DatabaseSchemaChecker;
use OC\App\CodeChecker\EmptyCheck;
use OC\App\CodeChecker\InfoChecker;
+use OC\App\CodeChecker\LanguageParseChecker;
use OC\App\InfoParser;
use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface;
use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext;
@@ -70,6 +72,12 @@ class CheckCode extends Command implements CompletionAwareInterface {
[ 'private', 'deprecation', 'strong-comparison' ]
)
->addOption(
+ '--skip-checkers',
+ null,
+ InputOption::VALUE_NONE,
+ 'skips the the code checkers to only check info.xml, language and database schema'
+ )
+ ->addOption(
'--skip-validate-info',
null,
InputOption::VALUE_NONE,
@@ -117,7 +125,10 @@ class CheckCode extends Command implements CompletionAwareInterface {
$output->writeln(" <error>line $line: {$p['disallowedToken']} - {$p['reason']}</error>");
}
});
- $errors = $codeChecker->analyse($appId);
+ $errors = [];
+ if(!$input->getOption('skip-checkers')) {
+ $errors = $codeChecker->analyse($appId);
+ }
if(!$input->getOption('skip-validate-info')) {
$infoChecker = new InfoChecker($this->infoParser);
@@ -171,6 +182,27 @@ class CheckCode extends Command implements CompletionAwareInterface {
$infoErrors = $infoChecker->analyse($appId);
$errors = array_merge($errors, $infoErrors);
+
+ $languageParser = new LanguageParseChecker();
+ $languageErrors = $languageParser->analyse($appId);
+
+ foreach ($languageErrors as $languageError) {
+ $output->writeln("<error>$languageError</error>");
+ }
+
+ $errors = array_merge($errors, $languageErrors);
+
+ $databaseSchema = new DatabaseSchemaChecker();
+ $schemaErrors = $databaseSchema->analyse($appId);
+
+ foreach ($schemaErrors['errors'] as $schemaError) {
+ $output->writeln("<error>$schemaError</error>");
+ }
+ foreach ($schemaErrors['warnings'] as $schemaWarning) {
+ $output->writeln("<comment>$schemaWarning</comment>");
+ }
+
+ $errors = array_merge($errors, $schemaErrors['errors']);
}
$this->analyseUpdateFile($appId, $output);