Skip to content

Commit

Permalink
Avoid running PHPDoc checker on excluded files.
Browse files Browse the repository at this point in the history
Instead of directory, use MoodlePlugin::getFiles call to identify the
list of files required for testing and pass them to moodlecheck cli
script.
  • Loading branch information
kabalin authored and polothy committed Feb 20, 2019
1 parent 8fa407f commit 5edcde2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Command/PHPDocCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Process\ProcessBuilder;

class PHPDocCommand extends AbstractMoodleCommand
Expand All @@ -34,6 +35,7 @@ protected function initialize(InputInterface $input, OutputInterface $output)
{
parent::initialize($input, $output);
$this->initializeExecute($output, $this->getHelper('process'));
$this->finder = Finder::create()->name('*.php');
}

protected function execute(InputInterface $input, OutputInterface $output)
Expand All @@ -50,11 +52,16 @@ protected function execute(InputInterface $input, OutputInterface $output)
$filesystem->mirror($plugin->directory, $directory);
}

$files = $this->plugin->getFiles($this->finder);
if (count($files) === 0) {
return $this->outputSkip($output);
}

$process = $this->execute->passThroughProcess(
ProcessBuilder::create()
->setPrefix('php')
->add('local/moodlecheck/cli/moodlecheck.php')
->add('-p='.$this->plugin->directory)
->add('-p='.implode(',', $files))
->add('-f=text')
->setTimeout(null)
->setWorkingDirectory($this->moodle->directory)
Expand Down

0 comments on commit 5edcde2

Please sign in to comment.