id-denylist
Forbid the use of the specified identifiers
Rule details
This rule ensures that identifiers are not included in a given list. It will catch:
- setting declarations
- command declarations
- constant declarations
- structure declarations
- structure member declarations
- function declarations
- function arguments declarations
- variables declarations
- labels declarations
Only declarations are checked. This prevents errors from being raised by code outside your control, such as using a constant from a library.
Settings
list
a list of values that identifiers cannot use. Default[]
.
Example of incorrect code for this rule:
maniascript
/*
{
"list" = [
"ForbiddenSetting",
"ForbiddenCommand",
"ForbiddenConstant",
"ForbiddenStruct",
"ForbiddenStructMember",
"ForbiddenFunction",
"ForbiddenFunctionArg",
"ForbiddenVariable",
"ForbiddenLabel"
]
}
*/
#Setting ForbiddenSetting 1
#Command ForbiddenCommand (Boolean)
#Const ForbiddenConstant 2
#Struct ForbiddenStruct {
Integer ForbiddenStructMember;
}
Void ForbiddenFunction() {}
Void ValidFunction(Integer ForbiddenFunctionArg) {}
main() {
declare Integer[] ForbiddenVariable;
+++ForbiddenLabel+++
}
Example of correct code for this rule:
maniascript
/*
{
"list" = [
"ForbiddenSetting",
"ForbiddenCommand",
"ForbiddenConstant",
"ForbiddenStruct",
"ForbiddenStructMember",
"ForbiddenFunction",
"ForbiddenFunctionArg",
"ForbiddenVariable",
"ForbiddenLabel"
]
}
*/
***ForbiddenLabel***
***
ForbiddenVariable = 1;
***
main() {
declare Integer A = ForbiddenSetting;
declare Integer B = ForbiddenConstant;
declare ForbiddenStruct C = ForbiddenStruct {
ForbiddenStructMember = 1
};
ForbiddenFunction();
}