You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Integrated with waffle.io for Project Management.
4
+
- Added documentation for writing script rules.
5
+
6
+
###Rules:
7
+
- AvoidUsingWMICmdlet rule: For PowerShell 3.0 and above, usage of WMI cmdlets is not recommended. This rule is to detect WMI cmdlet usage in scripts that are written for PS 3.0 and above.
8
+
- DSCTestsPresent rule: Resource module contains Tests folder with tests for given resource.
9
+
- UseOutputTypeCorrectly rule: If we can identify the type of an object that is outputted to the pipeline by a cmdlet, then that type must be listed in the OutputType attribute.
10
+
11
+
###Fixes:
12
+
13
+
- PSProvideVerboseMessage only throws warnings in non-advanced functions.
14
+
- Fix the issue in importing customized rule
15
+
16
+
17
+
18
+
19
+
##Relesed on Apr.24, 2015
20
+
21
+
###Features:
22
+
- Finalized three levels of Severity - Error/Warning/Information.
23
+
- Improved PSScriptAnalyzer engine behavior: emits non-terminating errors (Ex: for failed ast parse) and continues rule application when running on multiple scripts.
24
+
- Added wild card supports for rules in Invoke-ScriptAnalyzer and Get-ScriptAnalyzer. Eg. Invoke-ScriptAnalyzer -IncludeRule PSAvoid* will apply all rules starting with PSAvoid* in built in rule assemblies.
25
+
- Added -Severity to Get-ScriptAnalyzerRules. Get-ScriptAnalyzer -Severity will filter rules based on the severity given.
26
+
- Added Suppression functionality. Users are now able to specify suppression on certain parts of the scripts by specifying "SupressMessageAttribute" in the scripts. More details and documentations will be coming soon in blog posts. Also comes with this feature is the ability for users to display a list of suppressed messages.
27
+
28
+
###Rules:
29
+
30
+
- Added DSC Rules for resources including Parameter validation, Usage of standard DSC functions and return type validation. Rule checkings also support for DSC classes. Built-in DSC rules include:
31
+
+ UseStandardDSCFunctionsInResource
32
+
+ UseIdenticalParametersDSC
33
+
+ UseIdenticalMandatoryParametersDSC
34
+
+ ReturnCorrectTypesForDSCFunctions
35
+
- Added support in the engine to detect DSC configuration/resource files and disable default rule checkings on DSC configuration and resource files.
36
+
- UseShouldProcessForStateChangingFunctions - If an advanced function has Verbs like New/Start/Stop/Restart/Reset/Set- that will change system state, it should support ShouldProcess attribute.
37
+
38
+
39
+
###Fixes:
40
+
41
+
- Improved heuristics to detect usage of Username and Password instead of PSCredential type.
42
+
- Improved accuracy in the detection of uninitialized variables.
43
+
- Improved error messages to include error line numbers and file names.
44
+
- Identified usage of PSBound parameters and PowerShell supplied variables such as $MyInvocation to avoid unnecessary noise in the results returned by some of the built-in rules.
45
+
- Fixed terminating errors including "Illegal characters in Path".
It is generally accepted that you should never use Write-Host to create any script output whatsoever, unless your script (or function, or whatever) uses the Show verb (as in, Show-Performance). That verb explicitly means “show on the screen, with no other possibilities.” Like Show-Command.
8
+
9
+
##How to Fix
10
+
11
+
PTo fix a violation of this rule, please replace Write-Host with Write-Output.
$nonInitializedMessage="Variable 'a' is not initialized. Non-global variables must be initialized. To fix a violation of this rule, please initialize non-global variables."
0 commit comments