Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  Add PSR code validation.
  • Loading branch information
Jelle-S committed May 24, 2017
2 parents 6d3915c + e72dda0 commit 8b95d86
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/RoboFileBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,54 @@ protected function isSiteInstalled($worker, AbstractAuth $auth, $remote)
return $status && $migrateStatus != 'No migrations found.';
}

public function digipolisValidateCode()
{
$local = $this->getLocalSettings();
$directories = [
$local['project_root'] . '/src',
];

// Check if directories exist.
$checks = [];
foreach ($directories as $dir) {
if (!file_exists($dir)) {
continue;
}

$checks[] = $dir;
}
if (!$checks) {
$this->say('! No custom directories to run checks on.');
return;
}
$phpcs = $this
->taskPhpCs(
implode(' ', $checks),
'PSR1,PSR2',
$phpcsExtensions
)
->ignore([
'node_modules',
'Gruntfile.js',
'*.md',
'*.min.js',
'*.css'
])
->reportType('full');
$phpmd = $this->taskPhpMd(
implode(',', $checks),
'text',
$phpmdExtensions
);
$collection = $this->collectionBuilder();
// Add the PHPCS task to the rollback as well so we always have the full
// report.
$collection->rollback($phpcs);
$collection->addTask($phpmd);
$collection->addTask($phpcs);
return $collection;
}

protected function preRestoreBackupTask(
$worker,
AbstractAuth $auth,
Expand Down

0 comments on commit 8b95d86

Please sign in to comment.