Skip to content

Remove trailing whitespace #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified CustomPSScriptAnalyzerRules/ExampleScript.ps1
Binary file not shown.
2 changes: 1 addition & 1 deletion CustomPSScriptAnalyzerRules/MBAnalyzerRules.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Function Measure-PascalCase {
$Result = New-Object `
-Typename "Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.DiagnosticRecord" `
-ArgumentList "$((Get-Help $MyInvocation.MyCommand.Name).Description.Text)",$Violation.Extent,$PSCmdlet.MyInvocation.InvocationName,Information,$Null

$Results += $Result
}
}
Expand Down
22 changes: 11 additions & 11 deletions Merge-DscConfigData/Merge-DscConfigData.psm1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#Requires -Version 4
Function Merge-DscConfigData {
[CmdletBinding()]

Param(
[Parameter(Mandatory=$True,Position=0)]
[string]$BaseConfigFilePath,
Expand Down Expand Up @@ -36,26 +36,26 @@ Function Merge-DscConfigData {

# Proceeding with the merge only if $OverrideConfig is not null and has been evaluated as a hashtable
If ( $OverrideConfig -and ($OverrideConfig -is [hashtable]) ) {

#Casting the AllNodes array to a list in order to add elements to it
$BaseNodes = $BaseConfig.AllNodes -as [System.Collections.ArrayList]

Foreach ( $Node in $OverrideConfig.AllNodes ) {

$NodeInBaseConfig = $BaseNodes | Where-Object { $_.NodeName -eq $Node.NodeName }

If ( $NodeInBaseConfig ) {

Write-Verbose "The node $($Node.NodeName) is already present in the base config."

# Removing the NodeName entry from the current Node to keep only the actual settings
$Node.Remove('NodeName')

Foreach ($OverrideSettingKey in $Node.keys) {

# Checking if the setting already exists in the Base config
$KeyExistsInBaseNode = $NodeInBaseConfig.ContainsKey($OverrideSettingKey)

If ( $KeyExistsInBaseNode ) {
Write-Verbose "$($NodeInBaseConfig.NodeName).$OverrideSettingKey, in node $($NodeInBaseConfig.NodeName) is present in the base config, overriding its value."
$NodeInBaseConfig.$($OverrideSettingKey) = $Node.$($OverrideSettingKey)
Expand All @@ -67,7 +67,7 @@ Function Merge-DscConfigData {
}
}
Else { # If the node is not already present in the base base config

Write-Verbose "The node $($Node.NodeName) is absent in the base config, adding it."
$Null = $BaseNodes.Add($Node)
}
Expand All @@ -78,21 +78,21 @@ Function Merge-DscConfigData {
if ($OverrideConfig.NonNodeData -ne $null) {

if ($BaseConfig.NonNodeData -eq $null) {

# Use NonNodeData, in its entirety, from the Override configuration if NonNodeData does not exist in the Base configuration
$BaseConfig.NonNodeData = $OverrideConfig.NonNodeData

} else {

foreach ($NonNodeSetting in $OverrideConfig.NonNodeData.GetEnumerator()) {

# Checking if the setting already exists in the Base config
if ($BaseConfig.NonNodeData.ContainsKey($NonNodeSetting.name))
{
Write-Verbose -Message "The setting $($NonNodeSetting.name) is present in the base config, overring its value."
$BaseConfig.NonNodeData.Set_Item($NonNodeSetting.Name, $NonNodeSetting.value)
}
else
else
{
Write-Verbose -Message "The setting $($NonNodeSetting.name) is absent in the base config, ading it."
$BaseConfig.NonNodeData.Add($NonNodeSetting.Name, $NonNodeSetting.value)
Expand Down