public function execute() { require_once $this->mooshDir . "/includes/codesniffer_cli.php"; require_once $this->mooshDir . "/includes/coderepair/CodeRepair.php"; $moodle_sniffs = $this->mooshDir . "/vendor/moodlerooms/moodle-coding-standard/moodle"; $options = $this->expandedOptions; $interactive = $options['interactive']; if (isset($options['path'])) { $this->checkDirArg($options['path']); $path = $options['path']; } else { $path = $this->cwd; } $files = $this->_get_files($path); if ($options['repair'] === true) { $code_repair = new \CodeRepair($files); $code_repair->drymode = false; $code_repair->start(); } $phpcscli = new \codesniffer_cli(); $phpcs = new \PHP_CodeSniffer(1, 0, 'utf-8', (bool) $interactive); $phpcs->setCli($phpcscli); $phpcs->process($files, $moodle_sniffs); $phpcs->reporting->printReport('full', false, $phpcscli->getCommandLineValues(), null); }
public function execute() { require_once $this->mooshDir . "/includes/codesniffer/CodeSniffer.php"; require_once $this->mooshDir . "/includes/codesniffer/lib.php"; require_once $this->mooshDir . "/includes/coderepair/CodeRepair.php"; $moodle_sniffs = $this->mooshDir . "/includes/codesniffer/moodle"; $options = $this->expandedOptions; $interactive = $options['interactive']; if (isset($options['path'])) { $this->checkFileArg($options['path']); $path = $options['path']; } else { $path = $this->cwd; } $files = $this->_get_files($path); if ($options['repair'] === true) { $code_repair = new \CodeRepair($files); $code_repair->drymode = false; $code_repair->start(); } $phpcs = new \PHP_CodeSniffer(1, 0, 'utf-8', false); $phpcs->setCli(new \codesniffer_cli()); $numerrors = $phpcs->process($files, $moodle_sniffs); $phpcs->reporting->printReport('full', false, null); }