-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjust filter plugin validation requirements to comply with Moodle 4.5 #326
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #326 +/- ##
============================================
- Coverage 88.37% 88.34% -0.03%
- Complexity 738 757 +19
============================================
Files 76 77 +1
Lines 2296 2333 +37
============================================
+ Hits 2029 2061 +32
- Misses 267 272 +5 ☔ View full report in Codecov by Sentry. |
I am not familiar with +1 |
…validation. This address scenario where file is supposed to contain certain function call, such as `class_alias` in Filter plugin type backward compatibility support per https://moodledev.io/docs/4.5/devupdate#filter-plugins The patch makes possible for deleveloper to specify: * getRequiredFunctionCalls to make sure file contains function call as name suggests. * FileTokens::notFoundHint to give some context for requirement to improve developer experience. This works with FileTokens in any other validation methods.
Thanks David! I addressed those minor comments. Ignoring codecov for now, validating of rendered error string containing info from the hint will be covered when we add hints to other types of plugin errors (#330), one can see from snippets above that string containing a hint rendered correctly. |
This patch is addressing filter plugin validation compliance with 4.5 raised at #321. Filter API have been updated to use the standard Moodle Class Autoloading infrastructure (https://moodledev.io/docs/4.5/devupdate#filter-plugins), this introduced requirement for backward compatibility in addition to new filter class location.
Possible Moodle version compatibility options for plugins now become:
filter.php
containing classfilter_[pluginname]
.classes/text_filter.php
containing classtext_filter
.classes/text_filter.php
containing classtext_filter
and filefilter.php
containingclass_alias
.Possible Moodle versions test scenarios matrix:
The patch implements validation logic listed above and introduces 2 new methods:
getRequiredFunctionCalls
in plugin type specific Requirements class to validate that file contains function call.FileTokens::notFoundHint
can be used to give some context for validation error to improve developer experience.Currently this tool does not support the determine version compatibility declared in
version.php
($plugin->supported
), for this simple scenario I use file existence check as indicator of backward compatibility implemented in plugin, in future the tool would possibly benefit from using information from$plugin->supported
property.Changeset has been tested locally with https://github.com/gjbarnard/moodle-filter_synhi plugin:
4.5
, filter_synhimain
:4.5
, filter_synhimain
,filter.php
deleted:4.5
, filter_synhiV402.1.0
:4.4
, filter_synhiV402.1.0
:4.4
, filter_synhimain
:4.4
, filter_synhimain
,filter.php
deleted: