-
Notifications
You must be signed in to change notification settings - Fork 407
Description
I have a module called HistoryPx. In the manifest, I have the following:
$PSModule.OnRemove = {
# ...
}
$PSModule is initialized outside of this file in a snippet. That causes PSAvoidUnitializedVariable to be raise a warning. However, it seems the assignment that I am performing here is also generating a warning, but the warning is completely undecipherable. Here is the warning type/text:
RuleName: PSUseDeclaredVarsMoreThanAssignments
Message: The variable 'PSModule' is assigned but never used
First, what does PSUseDeclaredVarsMoreThanAssignments even mean? That name doesn't make any sense to me whatsoever.
Second, PSModule is not assigned but never used. In this scenario, I am assigning a value to a property on PSModule.
Third, I was already warned that PSModule is not initialized (even though it is), so why am I receiving another warning at all?
This warning simply doesn't make any sense whatsoever. The name should change to something that clearly indicates what rule is being checked, and the message should change to properly identify what is the issue that is being raised.
You may want to consider leaving the warning out in this case though because you already told me that PSModule is not initialized (which would be the one and only warning I would expect to see if I was assigning a value to a property of an uninitialized variable).