Skip to content

Commit

Permalink
Prevent plugin runs to use the moodle.Commenting.TodoComment sniff
Browse files Browse the repository at this point in the history
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 moodlehq#266
  • Loading branch information
stronk7 committed Jan 17, 2024
1 parent 1c2c65c commit 50e7728
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Command/CodeCheckerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 3 additions & 0 deletions tests/Fixture/moodle-local_ci/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit 50e7728

Please sign in to comment.