Skip to content

Commit 530d25a

Browse files
committed
Merge pull request #304 from PowerShell/BugFixes
Bug fixes to Master
2 parents 4babbbe + b00bfff commit 530d25a

File tree

3 files changed

+70
-1
lines changed

3 files changed

+70
-1
lines changed

CHANGELOG.MD

+21
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

+1-1
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

+48
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ If you have previous version of PSScriptAnalyzer installed on your machine, you
3939

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

42+
4243
Suppressing Rules
4344
=================
4445

@@ -119,6 +120,53 @@ To match all functions/variables/parameters/objects, use `*` as the value of the
119120

120121

121122

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

123171
Building the Code
124172
=================

0 commit comments

Comments
 (0)