Skip to content

Commit 6e56087

Browse files
committed
Merge branch 'development' of https://github.com/PowerShell/PSScriptAnalyzer into FixConsistentIndentationForPipeWithCommandInside
2 parents d636fb2 + 627f063 commit 6e56087

File tree

6 files changed

+33
-13
lines changed

6 files changed

+33
-13
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Note: the PSScriptAnalyzer Chocolatey package is provided and supported by the c
105105

106106
#### Requirements
107107

108-
* [.NET Core 2.1.401 SDK](https://www.microsoft.com/net/download/dotnet-core/2.1#sdk-2.1.401) or newer patch release
108+
* [.NET Core 2.1.502 SDK](https://www.microsoft.com/net/download/dotnet-core/2.1#sdk-2.1.502) or newer patch release
109109
* [PlatyPS 0.9.0 or greater](https://github.com/PowerShell/platyPS/releases)
110110
* Optionally but recommended for development: [Visual Studio 2017](https://www.visualstudio.com/downloads/)
111111

Rules/Strings.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Rules/Strings.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@
484484
<value>Function '{0}' has both Username and Password parameters. Either set the type of the Password parameter to SecureString or replace the Username and Password parameters with a Credential parameter of type PSCredential. If using a Credential parameter in PowerShell 4.0 or earlier, please define a credential transformation attribute after the PSCredential type attribute.</value>
485485
</data>
486486
<data name="AvoidUsernameAndPasswordParamsName" xml:space="preserve">
487-
<value>AvoidUsingUserNameAndPassWordParams</value>
487+
<value>AvoidUsingUsernameAndPasswordParams</value>
488488
</data>
489489
<data name="AvoidInvokingEmptyMembersCommonName" xml:space="preserve">
490490
<value>Avoid Invoking Empty Members</value>

Rules/UseStandardDSCFunctionsInResource.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public IEnumerable<DiagnosticRecord> AnalyzeDSCResource(Ast ast, string fileName
3535
List<string> expectedTargetResourceFunctionNames = new List<string>(new string[] { "Get-TargetResource", "Set-TargetResource", "Test-TargetResource" });
3636

3737
// Retrieve a list of Asts where the function name contains TargetResource
38-
IEnumerable<Ast> functionDefinitionAsts = (ast.FindAll(dscAst => dscAst is FunctionDefinitionAst && ((dscAst as FunctionDefinitionAst).Name.IndexOf("targetResource", StringComparison.CurrentCultureIgnoreCase) != -1), true));
38+
IEnumerable<Ast> functionDefinitionAsts = (ast.FindAll(dscAst => dscAst is FunctionDefinitionAst && ((dscAst as FunctionDefinitionAst).Name.IndexOf("targetResource", StringComparison.OrdinalIgnoreCase) != -1), true));
3939

4040
List<string> targetResourceFunctionNamesInAst = new List<string>();
4141
foreach (FunctionDefinitionAst functionDefinitionAst in functionDefinitionAsts)
@@ -46,7 +46,7 @@ public IEnumerable<DiagnosticRecord> AnalyzeDSCResource(Ast ast, string fileName
4646
foreach (string expectedTargetResourceFunctionName in expectedTargetResourceFunctionNames)
4747
{
4848
// If the Ast does not contain the expected functions, provide a Rule violation message
49-
if (!targetResourceFunctionNamesInAst.Contains(expectedTargetResourceFunctionName, StringComparer.CurrentCultureIgnoreCase))
49+
if (!targetResourceFunctionNamesInAst.Contains(expectedTargetResourceFunctionName, StringComparer.OrdinalIgnoreCase))
5050
{
5151
yield return new DiagnosticRecord(string.Format(CultureInfo.CurrentCulture, Strings.UseStandardDSCFunctionsInResourceError, expectedTargetResourceFunctionName),
5252
ast.Extent, GetName(), DiagnosticSeverity.Error, fileName);

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"sdk": {
3-
"version": "2.1.401"
3+
"version": "2.1.502"
44
}
55
}

tools/appveyor.psm1

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,33 @@ function Invoke-AppVeyorInstall {
3232

3333
# the legacy WMF4 image only has the old preview SDKs of dotnet
3434
$globalDotJson = Get-Content (Join-Path $PSScriptRoot '..\global.json') -Raw | ConvertFrom-Json
35-
$dotNetCoreSDKVersion = $globalDotJson.sdk.version
36-
# don't try to run this script on linux - we have to do the negative check because IsLinux will be defined in core, but not windows
37-
if (-not ((dotnet --version).StartsWith($dotNetCoreSDKVersion)) -and ! $IsLinux ) {
38-
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 # https://github.com/dotnet/announcements/issues/77
39-
Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1
40-
.\dotnet-install.ps1 -Version $dotNetCoreSDKVersion
41-
Remove-Item .\dotnet-install.ps1
35+
$requiredDotNetCoreSDKVersion = $globalDotJson.sdk.version
36+
if ($PSVersionTable.PSVersion.Major -gt 4) {
37+
$requiredDotNetCoreSDKVersionPresent = (dotnet --list-sdks) -match $requiredDotNetCoreSDKVersion
38+
}
39+
else {
40+
# WMF 4 image has old SDK that does not have --list-sdks parameter
41+
$requiredDotNetCoreSDKVersionPresent = (dotnet --version).StartsWith($requiredDotNetCoreSDKVersion)
42+
}
43+
if (-not $requiredDotNetCoreSDKVersionPresent) {
44+
Write-Verbose -Verbose "Installing required .Net CORE SDK $requiredDotNetCoreSDKVersion"
45+
$originalSecurityProtocol = [Net.ServicePointManager]::SecurityProtocol
46+
try {
47+
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
48+
if ($IsLinux -or $isMacOS) {
49+
Invoke-WebRequest 'https://dot.net/v1/dotnet-install.sh' -OutFile dotnet-install.sh
50+
bash dotnet-install.sh --version $requiredDotNetCoreSDKVersion
51+
[System.Environment]::SetEnvironmentVariable('PATH', "/home/appveyor/.dotnet$([System.IO.Path]::PathSeparator)$PATH")
52+
}
53+
else {
54+
Invoke-WebRequest 'https://dot.net/v1/dotnet-install.ps1' -OutFile dotnet-install.ps1
55+
.\dotnet-install.ps1 -Version $requiredDotNetCoreSDKVersion
56+
}
57+
}
58+
finally {
59+
[Net.ServicePointManager]::SecurityProtocol = $originalSecurityProtocol
60+
Remove-Item .\dotnet-install.*
61+
}
4262
}
4363
}
4464

0 commit comments

Comments
 (0)