mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2024-12-25 17:51:07 +00:00
Merge pull request #130 from therunnergit/checker-tools
Add tasks for checker tools
This commit is contained in:
commit
ab8dbab01a
55
RoboFile.php
55
RoboFile.php
@ -163,6 +163,37 @@ class RoboFile extends \Robo\Tasks
|
||||
->stopOnFail();
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the specified checker tool. Valid options are phpmd, phpcs, phpcpd
|
||||
*
|
||||
* @param string $tool
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function runChecker($tool = null)
|
||||
{
|
||||
if ($tool === null) {
|
||||
$this->say('You have to specify a tool name as argument. Valid tools are phpmd, phpcs, phpcpd.');
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!in_array($tool, array('phpmd', 'phpcs', 'phpcpd') )) {
|
||||
$this->say('The tool you required is not known. Valid tools are phpmd, phpcs, phpcpd.');
|
||||
return false;
|
||||
}
|
||||
|
||||
switch ($tool) {
|
||||
case 'phpmd':
|
||||
return $this->runPhpmd();
|
||||
|
||||
case 'phpcs':
|
||||
return $this->runPhpcs();
|
||||
|
||||
case 'phpcpd':
|
||||
return $this->runPhpcpd();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a testing Joomla site for running the tests (use it before run:test)
|
||||
*
|
||||
@ -337,4 +368,28 @@ class RoboFile extends \Robo\Tasks
|
||||
$this->say('Trying to kill the selenium server.');
|
||||
$this->_exec("curl http://$host:$port/selenium-server/driver/?cmd=shutDownSeleniumServer");
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the phpmd tool
|
||||
*/
|
||||
private function runPhpmd()
|
||||
{
|
||||
return $this->_exec('phpmd' . $this->extension . ' ' . __DIR__ . '/src xml cleancode,codesize,controversial,design,naming,unusedcode');
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the phpcs tool
|
||||
*/
|
||||
private function runPhpcs()
|
||||
{
|
||||
$this->_exec('phpcs' . $this->extension . ' ' . __DIR__ . '/src');
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the phpcpd tool
|
||||
*/
|
||||
private function runPhpcpd()
|
||||
{
|
||||
$this->_exec('phpcpd' . $this->extension . ' ' . __DIR__ . '/src');
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user