Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Commit

Permalink
Fix Archive test failures and forward port changes from xPSDesiredSta…
Browse files Browse the repository at this point in the history
…teConfiguration
  • Loading branch information
PlagueHO committed Jan 12, 2019
1 parent 1ba0e36 commit c75a92a
Show file tree
Hide file tree
Showing 11 changed files with 615 additions and 388 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text eol=crlf
*.exe binary
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
DSCResource.Tests
*.vscode
53 changes: 53 additions & 0 deletions .vscode/analyzersettings.psd1
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
@{
<#
For the custom rules to work, the DscResource.Tests repo must be
cloned. It is automatically clone as soon as any unit or
integration tests are run.
#>
CustomRulePath = '.\DSCResource.Tests\DscResource.AnalyzerRules'

IncludeRules = @(
# DSC Resource Kit style guideline rules.
'PSAvoidDefaultValueForMandatoryParameter',
'PSAvoidDefaultValueSwitchParameter',
'PSAvoidInvokingEmptyMembers',
'PSAvoidNullOrEmptyHelpMessageAttribute',
'PSAvoidUsingCmdletAliases',
'PSAvoidUsingComputerNameHardcoded',
'PSAvoidUsingDeprecatedManifestFields',
'PSAvoidUsingEmptyCatchBlock',
'PSAvoidUsingInvokeExpression',
'PSAvoidUsingPositionalParameters',
'PSAvoidShouldContinueWithoutForce',
'PSAvoidUsingWMICmdlet',
'PSAvoidUsingWriteHost',
'PSDSCReturnCorrectTypesForDSCFunctions',
'PSDSCStandardDSCFunctionsInResource',
'PSDSCUseIdenticalMandatoryParametersForDSC',
'PSDSCUseIdenticalParametersForDSC',
'PSMisleadingBacktick',
'PSMissingModuleManifestField',
'PSPossibleIncorrectComparisonWithNull',
'PSProvideCommentHelp',
'PSReservedCmdletChar',
'PSReservedParams',
'PSUseApprovedVerbs',
'PSUseCmdletCorrectly',
'PSUseOutputTypeCorrectly',
'PSAvoidGlobalVars',
'PSAvoidUsingConvertToSecureStringWithPlainText',
'PSAvoidUsingPlainTextForPassword',
'PSAvoidUsingUsernameAndPasswordParams',
'PSDSCUseVerboseMessageInDSCResource',
'PSShouldProcess',
'PSUseDeclaredVarsMoreThanAssignments',
'PSUsePSCredentialType',

<#
This is to test all the DSC Resource Kit custom rules.
The name of the function-blocks of each custom rule start
with 'Measure*'.
#>
'Measure-*'
)
}
14 changes: 14 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"powershell.codeFormatting.openBraceOnSameLine": false,
"powershell.codeFormatting.newLineAfterOpenBrace": false,
"powershell.codeFormatting.newLineAfterCloseBrace": true,
"powershell.codeFormatting.whitespaceBeforeOpenBrace": true,
"powershell.codeFormatting.whitespaceBeforeOpenParen": true,
"powershell.codeFormatting.whitespaceAroundOperator": true,
"powershell.codeFormatting.whitespaceAfterSeparator": true,
"powershell.codeFormatting.ignoreOneLineBlock": false,
"powershell.codeFormatting.preset": "Custom",
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"powershell.scriptAnalysis.settingsPath": ".vscode\\analyzersettings.psd1"
}
20 changes: 11 additions & 9 deletions DscResources/CommonResourceHelper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
#>
function Test-IsNanoServer
{
[OutputType([Boolean])]
[OutputType([System.Boolean])]
[CmdletBinding()]
param ()

$isNanoServer = $false

if (Test-CommandExists -Name 'Get-ComputerInfo')
{
$computerInfo = Get-ComputerInfo -ErrorAction 'SilentlyContinue'
Expand Down Expand Up @@ -37,13 +37,13 @@ function Test-IsNanoServer
#>
function Test-CommandExists
{
[OutputType([Boolean])]
[OutputType([System.Boolean])]
[CmdletBinding()]
param
param
(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String] $Name
[System.String] $Name
)

$command = Get-Command -Name $Name -ErrorAction 'SilentlyContinue'
Expand All @@ -67,12 +67,12 @@ function New-InvalidArgumentException
(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]
[System.String]
$Message,

[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]
[System.String]
$ArgumentName
)

Expand Down Expand Up @@ -102,10 +102,12 @@ function New-InvalidOperationException
[CmdletBinding()]
param
(
[Parameter()]
[ValidateNotNullOrEmpty()]
[String]
[System.String]
$Message,

[Parameter()]
[ValidateNotNull()]
[System.Management.Automation.ErrorRecord]
$ErrorRecord
Expand Down Expand Up @@ -155,7 +157,7 @@ function Get-LocalizedData
(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]
[System.String]
$ResourceName
)

Expand Down
Loading

0 comments on commit c75a92a

Please sign in to comment.