I created a feature in my private fork of surya that adds the -n parameter to the mdreport command. When this parameter is defined, it also lists the modifiers that are NOT present. This may help catch issues relating to missing modifiers.
In the above scenario, onlyMinters, onlyMasterMinter, checkWhitelist, are shown to be NOT present.
Note that the way this is implemented is by running:
parser.visit(ast, {
ModifierInvocation: function ModifierInvocation(node){
if (modifiers.indexOf(node.name) == -1){
modifiers.push(node.name);
}
},
ModifierDefinition: function ModifierDefinition(node){
if (modifiers.indexOf(node.name) == -1){
modifiers.push(node.name);
}
}
});
before the main call to parser.visit to enumerate all of the modifiers called in this file. All modifiers that are invoked AND all modifiers that are defined are evaluated and pushed into an array. That array is used to determine which modifiers are missing. If there is a better implementation for this, I'd love to know.
Thanks, hope others will find this useful as well.
Rhynorater
I created a feature in my private fork of surya that adds the
-n
parameter to themdreport
command. When this parameter is defined, it also lists the modifiers that are NOT present. This may help catch issues relating to missing modifiers.In the above scenario,
onlyMinters
,onlyMasterMinter
,checkWhitelist
, are shown to be NOT present.Note that the way this is implemented is by running:
before the main call to
parser.visit
to enumerate all of the modifiers called in this file. All modifiers that are invoked AND all modifiers that are defined are evaluated and pushed into an array. That array is used to determine which modifiers are missing. If there is a better implementation for this, I'd love to know.Thanks, hope others will find this useful as well. Rhynorater