Skip to content

Commit

Permalink
Merge pull request #304 from PowerShell/BugFixes
Browse files Browse the repository at this point in the history
Bug fixes to Master
  • Loading branch information
raghushantha committed Sep 1, 2015
2 parents 4babbbe + b00bfff commit 530d25a
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
21 changes: 21 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Engine/PSScriptAnalyzer.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
=================

Expand Down Expand Up @@ -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<DiagnosticRecord> AnalyzePath(string path,
[bool searchRecursively = false])

public System.Collections.Generic.IEnumerable<IRule> GetRule(string[] moduleNames,
string[] ruleNames)
```


Building the Code
=================
Expand Down

0 comments on commit 530d25a

Please sign in to comment.