Skip to content

Commit

Permalink
Downgrade to warning the new MoodleInternalNotNeeded error
Browse files Browse the repository at this point in the history
When the new detection was planned at #152, it was agreed
to make it a warning, not an error.

Instead, I missed that completely and implemented it as error.

So, this simple PR just downgrades the check to warning, as
originally planned.
  • Loading branch information
stronk7 committed Jan 16, 2022
1 parent d9fced8 commit 8a7ab1f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion moodle/Sniffs/Files/MoodleInternalSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function process(File $file, $pointer) {

// Having MOODLE_INTERNAL, not having side effects and not having multiple artifacts, error.
if ($hasMoodleInternal && !$hasSideEffects && !$hasMultipleArtifacts) {
$file->addError('Unexpected MOODLE_INTERNAL check. No side effects or multiple artifacts detected.',
$file->addWarning('Unexpected MOODLE_INTERNAL check. No side effects or multiple artifacts detected.',
$pointer, 'MoodleInternalNotNeeded');
return;
}
Expand Down
4 changes: 2 additions & 2 deletions moodle/tests/files_moodleinternal_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ public function test_moodle_files_moodleinternal_unexpected() {
$this->set_sniff('moodle.Files.MoodleInternal');
$this->set_fixture(__DIR__ . '/fixtures/files/moodleinternal/unexpected.php');

$this->set_errors([
$this->set_errors([]);
$this->set_warnings([
17 => 'MoodleInternalNotNeeded'
]);
$this->set_warnings([]);

$this->verify_cs_results();
}
Expand Down

0 comments on commit 8a7ab1f

Please sign in to comment.