Expand Minimize


Correctness rules check the PowerShell code for correct usage.


Rule Description Type Severity
SPC019101: Do not use empty Catch Blocks Empty catch blocks are a poor design. Always output an error and use error handling in the event of an exception. PowerShell File CriticalWarning
SPC019102: Do not invoke non constant members Using variable member invocations can result in an empty invocation from occurring. This can result in undesired circumstances. PowerShell File CriticalWarning
SPC019103: Do not use special characters in method names The use of special characters in method names can result in parser errors when executing the script. PowerShell File CriticalError
SPC019104: Do not use reserved parameters as parameter names Exceptions and unwanted bahaviour occurs when reserved parameters are used as paramater names. PowerShell File CriticalError
SPC019105: Functions that use ShouldContinue should have a boolean force parameter Functions that use ShouldContinue should have a boolean force parameter to allow bypassing the prompt PowerShell File CriticalWarning
SPC019106: Do not use trap statements Trap statements are designed for administrators. Try Catch should be used in all written script files. History: Trap was implemented in v1, because it was all the PowerShell team had time to implement. PowerShell File CriticalWarning
SPC019107: Do not use unitialized variables Uninitialized variables will cause script errors, and should never be used before assignment. PowerShell File CriticalWarning
SPC019108: Incorrect precedence for comparison operator against null If the item on the left hand side is an Array, PowerShell will automatically check the whole Array for null. PowerShell File CriticalWarning
SPC019109: Use only approved verbs The approved verbs are designed to describe the scope of the action, not using them can confuse the scripts intention to the end user. PowerShell File Warning
SPC019110: Use a Byte Order Mark with non Ascii files Ascii is a 7-bit to the byte encoding. Files that use UTF-8/UTF-16 or another encoding should use a byte order mark to allow identification. PowerShell File CriticalWarning
SPC019111: Call CmdLets with correct parameters CmdLets must be called with the correct syntax and parameters. PowerShell File CriticalWarning
SPC019112: Remove unused variable Variables that have been assigned but not used should be removed for better supportability in the future. Having unused variables can confuse the scripts intent. PowerShell File Warning
SPC019113: Declare output types correctly No exception will be thrown if you pass the wrong type, which can result in undesired results. PowerShell File CriticalWarning
SPC019114: Use singular nouns for CmdLets As standard practice for PowerShell, CmdLets should be named Verb-Noun in the singular form. PowerShell File Warning
Disclaimer: The views and opinions expressed in this documentation and in SPCAF do not necessarily reflect the opinions and recommendations of Microsoft or any member of Microsoft. SPCAF and RENCORE are registered trademarks of Rencore. All other trademarks, service marks, collective marks, copyrights, registered names, and marks used or cited by this documentation are the property of their respective owners.