Skip to content

Commit 5edcde2

Browse files
kabalinpolothy
authored andcommitted
Avoid running PHPDoc checker on excluded files.
Instead of directory, use MoodlePlugin::getFiles call to identify the list of files required for testing and pass them to moodlecheck cli script.
1 parent 8fa407f commit 5edcde2

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/Command/PHPDocCommand.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Symfony\Component\Console\Input\InputInterface;
1717
use Symfony\Component\Console\Output\OutputInterface;
1818
use Symfony\Component\Filesystem\Filesystem;
19+
use Symfony\Component\Finder\Finder;
1920
use Symfony\Component\Process\ProcessBuilder;
2021

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

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

55+
$files = $this->plugin->getFiles($this->finder);
56+
if (count($files) === 0) {
57+
return $this->outputSkip($output);
58+
}
59+
5360
$process = $this->execute->passThroughProcess(
5461
ProcessBuilder::create()
5562
->setPrefix('php')
5663
->add('local/moodlecheck/cli/moodlecheck.php')
57-
->add('-p='.$this->plugin->directory)
64+
->add('-p='.implode(',', $files))
5865
->add('-f=text')
5966
->setTimeout(null)
6067
->setWorkingDirectory($this->moodle->directory)

0 commit comments

Comments
 (0)