diff --git a/CHANGELOG.MD b/CHANGELOG.MD index b81273723..b76321056 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,3 +1,24 @@ +## Released v1.1.0 (Sep.1, 2015) +###Features: +- Support for using ScriptAnalyzer as a .net library - ScriptAnalyzer APIs +- Support for ScriptAnalyzer Profiles +- Documentation for using Inline Rule Suppression +- Added about help topic file as part of the module + + +###Rules: +- Rule to checks for UTF8 encoding in help file +- Deprecate Uninitialized Variable rule as per community feedback + + +###Fixes: +- Fix false positive for UsingInternalURL +- WriteVerbose only when analyzing valid powershell files +- DSCClass rules not being applied when exclude rule is used +- Add host to list of initialized variable +- Exclude external non-powershell applications (Console/GUI) from Positional Parameter rule application +- Additional heuristics for detecting psavoidusingplaintextforpassword rule violation + ## Released v1.0.2 (June.24, 2015) ###Features: - Perf improvements in the Engine to execute rules concurrently. diff --git a/Engine/PSScriptAnalyzer.psd1 b/Engine/PSScriptAnalyzer.psd1 index 7a1a109db..7061f8c6d 100644 --- a/Engine/PSScriptAnalyzer.psd1 +++ b/Engine/PSScriptAnalyzer.psd1 @@ -11,7 +11,7 @@ Author = 'Microsoft Corporation' RootModule = 'Microsoft.Windows.PowerShell.ScriptAnalyzer.dll' # Version number of this module. -ModuleVersion = '1.0.2' +ModuleVersion = '1.1.0' # ID used to uniquely identify this module GUID = '324fc715-36bf-4aee-8e58-72e9b4a08ad9' diff --git a/README.md b/README.md index 0de5ddc6c..5a71b127c 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ If you have previous version of PSScriptAnalyzer installed on your machine, you To confirm installation: run ```Get-ScriptAnalyzerRule``` in the PowerShell console to obtain the built-in rules + Suppressing Rules ================= @@ -119,6 +120,53 @@ To match all functions/variables/parameters/objects, use `*` as the value of the +Profile support in ScriptAnalyzer +======================================== + +Profiles that describe ScriptAnalyzer rules to include/exclude based on `Severity` can be created and supplied to `Invoke-ScriptAnalyzer` using the `-profile` parameter. This enables a user to create custom configuration for a specific environment. + +Using Profile support: + +```powershell +$myProfile = @{ + Severity='Warning' + IncludeRules=@('PSAvoidUsingCmdletAliases', + 'PSAvoidUsingPositionalParameters', + 'PSAvoidUsingInternalURLs' + 'PSAvoidUninitializedVariable') + ExcludeRules=@('PSAvoidUsingCmdletAliases' + 'PSAvoidUninitializedVariable') +} + +Invoke-ScriptAnalyzer -path MyScript.ps1 -Profile $myProfile +``` + +ScriptAnalyzer as a .net library +================================ + +ScriptAnalyzer engine and functionality can now be directly consumed as a library. + +Here are the public interfaces: + +```c# +using Microsoft.Windows.PowerShell.ScriptAnalyzer; + +public void Initialize(System.Management.Automation.Runspaces.Runspace runspace, +Microsoft.Windows.PowerShell.ScriptAnalyzer.IOutputWriter outputWriter, +[string[] customizedRulePath = null], +[string[] includeRuleNames = null], +[string[] excludeRuleNames = null], +[string[] severity = null], +[bool suppressedOnly = false], +[string profile = null]) + +public System.Collections.Generic.IEnumerable AnalyzePath(string path, +[bool searchRecursively = false]) + +public System.Collections.Generic.IEnumerable GetRule(string[] moduleNames, +string[] ruleNames) +``` + Building the Code =================