From 50e7728f681825afe53fee6debca36756bcbe3ac Mon Sep 17 00:00:00 2001 From: "Eloy Lafuente (stronk7)" Date: Wed, 17 Jan 2024 20:02:05 +0100 Subject: [PATCH] Prevent plugin runs to use the moodle.Commenting.TodoComment sniff That sniff covers the core coding style and verifies that all the TODOs (inline or phpdoc block), have a MDL issue associated. But that's not a requirements for plugins, hence disabling that Sniff for them. Fixes #266 --- src/Command/CodeCheckerCommand.php | 9 +++++++++ tests/Fixture/moodle-local_ci/lib.php | 3 +++ 2 files changed, 12 insertions(+) diff --git a/src/Command/CodeCheckerCommand.php b/src/Command/CodeCheckerCommand.php index bc153c62..b3dd72e1 100644 --- a/src/Command/CodeCheckerCommand.php +++ b/src/Command/CodeCheckerCommand.php @@ -79,6 +79,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int // @codeCoverageIgnoreEnd $exclude = $input->getOption('exclude'); + + // There are some differences in the checks performed when the code to + // check is a plugin or a Moodle core directory. And, here, we are always + // checking a plugin, so we need to exclude some checks that are not + // applicable. + // TODO: If https://github.com/moodlehq/moodle-cs/issues/92 becomes implemented, then + // we'll just have to change to the new, plugins specific, standard and forget. + $exclude .= (!empty($exclude) ? ',' : '') . 'moodle.Commenting.TodoComment'; + $cmd = array_merge($basicCMD, [ '--standard=' . ($input->getOption('standard') ?: 'moodle'), '--extensions=php', diff --git a/tests/Fixture/moodle-local_ci/lib.php b/tests/Fixture/moodle-local_ci/lib.php index 5312d695..ae928c1c 100644 --- a/tests/Fixture/moodle-local_ci/lib.php +++ b/tests/Fixture/moodle-local_ci/lib.php @@ -22,6 +22,9 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +// TODO: This todo comment without any MDL link is good for moodle-plugin-ci +// (because we disable the moodle.Commenting.TodoComment sniff for plugins). + /** * Add *