Skip to content

Commit 24f7858

Browse files
committed
Merge pull request #333 from PowerShell/master
Merge Branches
2 parents 0b6dece + 44949a6 commit 24f7858

File tree

3 files changed

+70
-1
lines changed

3 files changed

+70
-1
lines changed

CHANGELOG.MD

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
## Released v1.1.0 (Sep.1, 2015)
2+
###Features:
3+
- Support for using ScriptAnalyzer as a .net library - ScriptAnalyzer APIs
4+
- Support for ScriptAnalyzer Profiles
5+
- Documentation for using Inline Rule Suppression
6+
- Added about help topic file as part of the module
7+
8+
9+
###Rules:
10+
- Rule to checks for UTF8 encoding in help file
11+
- Deprecate Uninitialized Variable rule as per community feedback
12+
13+
14+
###Fixes:
15+
- Fix false positive for UsingInternalURL
16+
- WriteVerbose only when analyzing valid powershell files
17+
- DSCClass rules not being applied when exclude rule is used
18+
- Add host to list of initialized variable
19+
- Exclude external non-powershell applications (Console/GUI) from Positional Parameter rule application
20+
- Additional heuristics for detecting psavoidusingplaintextforpassword rule violation
21+
122
## Released v1.0.2 (June.24, 2015)
223
###Features:
324
- Perf improvements in the Engine to execute rules concurrently.

Engine/PSScriptAnalyzer.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Author = 'Microsoft Corporation'
1111
RootModule = 'Microsoft.Windows.PowerShell.ScriptAnalyzer.dll'
1212

1313
# Version number of this module.
14-
ModuleVersion = '1.0.2'
14+
ModuleVersion = '1.1.0'
1515

1616
# ID used to uniquely identify this module
1717
GUID = '324fc715-36bf-4aee-8e58-72e9b4a08ad9'

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ If you have previous version of PSScriptAnalyzer installed on your machine, you
5252

5353
To confirm installation: run ```Get-ScriptAnalyzerRule``` in the PowerShell console to obtain the built-in rules
5454

55+
5556
Suppressing Rules
5657
=================
5758

@@ -132,6 +133,53 @@ To match all functions/variables/parameters/objects, use `*` as the value of the
132133

133134

134135

136+
Profile support in ScriptAnalyzer
137+
========================================
138+
139+
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.
140+
141+
Using Profile support:
142+
143+
```powershell
144+
$myProfile = @{
145+
Severity='Warning'
146+
IncludeRules=@('PSAvoidUsingCmdletAliases',
147+
'PSAvoidUsingPositionalParameters',
148+
'PSAvoidUsingInternalURLs'
149+
'PSAvoidUninitializedVariable')
150+
ExcludeRules=@('PSAvoidUsingCmdletAliases'
151+
'PSAvoidUninitializedVariable')
152+
}
153+
154+
Invoke-ScriptAnalyzer -path MyScript.ps1 -Profile $myProfile
155+
```
156+
157+
ScriptAnalyzer as a .net library
158+
================================
159+
160+
ScriptAnalyzer engine and functionality can now be directly consumed as a library.
161+
162+
Here are the public interfaces:
163+
164+
```c#
165+
using Microsoft.Windows.PowerShell.ScriptAnalyzer;
166+
167+
public void Initialize(System.Management.Automation.Runspaces.Runspace runspace,
168+
Microsoft.Windows.PowerShell.ScriptAnalyzer.IOutputWriter outputWriter,
169+
[string[] customizedRulePath = null],
170+
[string[] includeRuleNames = null],
171+
[string[] excludeRuleNames = null],
172+
[string[] severity = null],
173+
[bool suppressedOnly = false],
174+
[string profile = null])
175+
176+
public System.Collections.Generic.IEnumerable<DiagnosticRecord> AnalyzePath(string path,
177+
[bool searchRecursively = false])
178+
179+
public System.Collections.Generic.IEnumerable<IRule> GetRule(string[] moduleNames,
180+
string[] ruleNames)
181+
```
182+
135183

136184
Building the Code
137185
=================

0 commit comments

Comments
 (0)