Skip to content

Commit 091c71d

Browse files
author
Kapil Borle
committed
Resolve merge conflict
2 parents 5e29444 + 4600e39 commit 091c71d

File tree

6 files changed

+254
-146
lines changed

6 files changed

+254
-146
lines changed

CHANGELOG.MD

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
## Released v1.4.0 (Feb.16, 2016)
1+
## Release v1.5.0 (Mar. 30, 2016)
2+
3+
#### Engine
4+
- Fixed an engine bug that prevented versioned script rule modules from being loaded
5+
- Fixed loading issues with custom rules that do not have comment-based help to describe the rule
6+
- Fixed a hang issue that appeared when using ScriptAnalyzer engine recursively with a large data set
7+
- Housekeeping: Fixed Appveyor config to use VS 2015 and WMF 5.0 RTM image
8+
- Community Fix: Updated the Initialize API to process the `-Settings` (formerly `-Profile`) parameter
9+
- Perf: Improved rule filtering based on severity before invoking the engine to create tasks (threads)
10+
11+
#### Rules
12+
- Fixed `UseToExportFieldsInManifest` rule to improve perf and functionality
13+
- Fixed `AvoidNullOrEmptyHelpMessageAttribute` to use parsed values instead of ast extent
14+
- Fixed inconsistencies in severities of rules
15+
- Community Fix: Fixed false positives on `PSUseApprovedVerbs` when scope is declared as a prefix to the Verb-Noun combination
16+
- Updated messages of `AvoidUsernameAndPasswordParams` rule and `UsePSCredentialType` rule
17+
18+
## Release v1.4.0 (Feb.16, 2016)
219
###Features:
320
- IncludeRule and ExcludeRule now consume RuleInfo objects
421

@@ -18,7 +35,7 @@
1835
- Support for [switch] type along with [boolean] for ShouldContinueWithoutForce rule
1936
- Improved handling of deprecated module manifest fields when PSv2.0 is specified in the manifest
2037

21-
## Released v1.3.0 (Jan.19, 2016)
38+
## Release v1.3.0 (Jan.19, 2016)
2239
###Features:
2340
- Support for running ScriptAnalyzer on PowerShell version v3 or higher! This means PSv5 is no longer the minimum PS version for ScriptAnalyzer
2441

@@ -34,7 +51,7 @@
3451
- Fix to account for function scope prefix
3552
- Raise ReservedParam rule only for exported functions as cmdlets
3653

37-
## Released v1.2.0 (Dec.17, 2015)
54+
## Release v1.2.0 (Dec.17, 2015)
3855
###Features:
3956
- Support for consuming PowerShell content as streams (-ScriptDefinition)
4057
- ScriptAnalyzer accepts configuration (settings) in the form of a hashtable (-Settings), added sample Settings
@@ -71,7 +88,7 @@
7188

7289
##
7390

74-
## Released v1.1.1 (Nov.3, 2015)
91+
## Release v1.1.1 (Nov.3, 2015)
7592
###Features:
7693
- Support for PSDrives when using Invoke-ScriptAnalyzer
7794
- More robust Profiles feature - better defaulting when supplied with invalid profile - actionable Warnings
@@ -87,7 +104,7 @@
87104

88105
##
89106

90-
## Released v1.1.0 (Sep.1, 2015)
107+
## Release v1.1.0 (Sep.1, 2015)
91108
###Features:
92109
- Support for using ScriptAnalyzer as a .net library - ScriptAnalyzer APIs
93110
- Support for ScriptAnalyzer Profiles
@@ -109,7 +126,7 @@
109126

110127
##
111128

112-
## Released v1.0.2 (June.24, 2015)
129+
## Release v1.0.2 (June.24, 2015)
113130
###Features:
114131
- Perf improvements in the Engine to execute rules concurrently.
115132

@@ -137,7 +154,7 @@
137154

138155
##
139156

140-
## Released v1.0.1 (May.8, 2015)
157+
## Release v1.0.1 (May.8, 2015)
141158
###Features:
142159
- Integrated with waffle.io for Project Management.
143160
- Added documentation for writing script rules.

Engine/Helper.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class Helper
3333

3434
private CommandInvocationIntrinsics invokeCommand;
3535
private IOutputWriter outputWriter;
36+
private Object getCommandLock = new object();
3637

3738
#endregion
3839

@@ -101,9 +102,9 @@ internal set
101102
/// </summary>
102103
private Dictionary<Ast, VariableAnalysis> VariableAnalysisDictionary;
103104

104-
private string[] functionScopes = new string[] { "global:", "local:", "script:", "private:" };
105+
private string[] functionScopes = new string[] { "global:", "local:", "script:", "private:"};
105106

106-
private string[] variableScopes = new string[] { "global:", "local:", "script:", "private:", "variable:", ":" };
107+
private string[] variableScopes = new string[] { "global:", "local:", "script:", "private:", "variable:", ":"};
107108
#endregion
108109

109110
/// <summary>
@@ -475,7 +476,8 @@ private string NameWithoutScope(string name, string[] scopes)
475476
foreach (string scope in scopes)
476477
{
477478
// trim the scope part
478-
if (name.IndexOf(scope) == 0)
479+
if (name.IndexOf(scope, StringComparison.OrdinalIgnoreCase) == 0)
480+
479481
{
480482
return name.Substring(scope.Length);
481483
}
@@ -623,7 +625,10 @@ public bool PositionalParameterUsed(CommandAst cmdAst, bool moreThanThreePositio
623625
/// <returns></returns>
624626
public CommandInfo GetCommandInfo(string name, CommandTypes commandType = CommandTypes.Alias | CommandTypes.Cmdlet | CommandTypes.Configuration | CommandTypes.ExternalScript | CommandTypes.Filter | CommandTypes.Function | CommandTypes.Script | CommandTypes.Workflow)
625627
{
626-
return this.invokeCommand.GetCommand(name, commandType);
628+
lock (getCommandLock)
629+
{
630+
return this.invokeCommand.GetCommand(name, commandType);
631+
}
627632
}
628633

629634
/// <summary>
@@ -3077,4 +3082,4 @@ public object VisitUsingExpression(UsingExpressionAst usingExpressionAst)
30773082
return null;
30783083
}
30793084
}
3080-
}
3085+
}

Engine/PSScriptAnalyzer.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Author = 'Microsoft Corporation'
1111
RootModule = 'PSScriptAnalyzer.psm1'
1212

1313
# Version number of this module.
14-
ModuleVersion = '1.4.0'
14+
ModuleVersion = '1.5.0'
1515

1616
# ID used to uniquely identify this module
1717
GUID = '324fc715-36bf-4aee-8e58-72e9b4a08ad9'
@@ -20,7 +20,7 @@ GUID = '324fc715-36bf-4aee-8e58-72e9b4a08ad9'
2020
CompanyName = 'Microsoft Corporation'
2121

2222
# Copyright statement for this module
23-
Copyright = '(c) Microsoft Corporation 2015. All rights reserved.'
23+
Copyright = '(c) Microsoft Corporation 2016. All rights reserved.'
2424

2525
# Description of the functionality provided by this module
2626
Description = 'PSScriptAnalyzer provides script analysis and checks for potential code defects in the scripts by applying a group of built-in or customized rules on the scripts being analyzed.'

0 commit comments

Comments
 (0)