Skip to content

Commit

Permalink
Code Formatting (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
raandree committed Mar 19, 2021
1 parent 489e1fb commit 82de9ce
Show file tree
Hide file tree
Showing 81 changed files with 864 additions and 683 deletions.
8 changes: 4 additions & 4 deletions .vscode/analyzersettings.psd1
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
@{
CustomRulePath = '.\output\RequiredModules\DscResource.AnalyzerRules'
includeDefaultRules = $true
ExcludeRules = @(
ExcludeRules = @(
'Measure-ForEachStatement',
'Measure-FunctionBlockBrace',
'Measure-IfStatement',
'Measure-ParameterBlockParameterAttribute',
'Measure-ParameterBlockMandatoryNamedArgument'
)
IncludeRules = @(

IncludeRules = @(
# DSC Resource Kit style guideline rules.
'PSAvoidDefaultValueForMandatoryParameter',
'PSAvoidDefaultValueSwitchParameter',
Expand Down Expand Up @@ -49,4 +49,4 @@
'Measure-*'
)

}
}
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
"powershell.codeFormatting.preset": "Custom",
"powershell.codeFormatting.alignPropertyValuePairs": true,
"powershell.developer.bundledModulesPath": "${cwd}/output/RequiredModules",
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"powershell.scriptAnalysis.settingsPath": ".vscode\\analyzersettings.psd1",
"powershell.scriptAnalysis.enable": true,
"files.trimTrailingWhitespace": true,
"files.trimFinalNewlines": true,
"files.insertFinalNewline": true,
"files.associations": {
"*.ps1xml": "xml"
},
Expand Down
10 changes: 8 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@
"label": "build",
"type": "shell",
"command": "&${cwd}/build.ps1",
"args": ["-AutoRestore"],
"args": [
"-AutoRestore"
],
"presentation": {
"echo": true,
"reveal": "always",
Expand Down Expand Up @@ -84,7 +86,11 @@
"label": "test",
"type": "shell",
"command": "&${cwd}/build.ps1",
"args": ["-AutoRestore","-Tasks","test"],
"args": [
"-AutoRestore",
"-Tasks",
"test"
],
"presentation": {
"echo": true,
"reveal": "always",
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed how issue not allowing Datum handlers to be used on arrays (#89).
- Fixed issue in Merge-Hashtable where it did not merge hashtables correctly when these
are included in an array.
- Formatting in all files with VSCode formatting according to the 'settings.json' file taken from Sampler

## [0.0.39] - 2020-09-29

Expand Down
8 changes: 3 additions & 5 deletions GitVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ major-version-bump-message: '\s?(breaking|major|breaking\schange)'
minor-version-bump-message: '(adds?|features?|minor)\b'
patch-version-bump-message: '\s?(fix|patch)'
no-bump-message: '\+semver:\s?(none|skip)'
assembly-informational-format: '{NuGetVersionV2}+Sha.{Sha}.Date.{CommitDate}'
assembly-informational-format: "{NuGetVersionV2}+Sha.{Sha}.Date.{CommitDate}"
branches:
master:
tag: preview
Expand All @@ -14,18 +14,16 @@ branches:
tag: useBranchName
increment: Minor
regex: f(eature(s)?)?[\/-]
source-branches: ['master']
source-branches: ["master"]
hotfix:
tag: fix
increment: Patch
regex: (hot)?fix(es)?[\/-]
source-branches: ['master']
source-branches: ["master"]

ignore:
sha: []
merge-message-formats: {}


# feature:
# tag: useBranchName
# increment: Minor
Expand Down
6 changes: 3 additions & 3 deletions RequiredModules.psd1
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@{
# Set up a mini virtual environment...
PSDependOptions = @{
AddToPath = $true
Target = 'output\RequiredModules'
PSDependOptions = @{
AddToPath = $true
Target = 'output\RequiredModules'
Parameters = @{
}
}
Expand Down
32 changes: 16 additions & 16 deletions Resolve-Dependency.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ try
$variableValue = $ExecutionContext.InvokeCommand.ExpandString($variableValue)
}
$PSBoundParameters.Add($ParamName, $variableValue)
Set-Variable -Name $ParamName -value $variableValue -Force -ErrorAction SilentlyContinue
Set-Variable -Name $ParamName -Value $variableValue -Force -ErrorAction SilentlyContinue
}
catch
{
Expand All @@ -96,7 +96,7 @@ catch
Write-Warning -Message "Error attempting to import Bootstrap's default parameters from $(Join-Path $PSScriptRoot '.\Resolve-Dependency.psd1'): $($_.Exception.Message)."
}

Write-Progress -Activity "Bootstrap:" -PercentComplete 0 -CurrentOperation "NuGet Bootstrap"
Write-Progress -Activity 'Bootstrap:' -PercentComplete 0 -CurrentOperation 'NuGet Bootstrap'

if (!(Get-PackageProvider -Name NuGet -ForceBootstrap -ErrorAction SilentlyContinue))
{
Expand Down Expand Up @@ -128,29 +128,29 @@ if (!(Get-PackageProvider -Name NuGet -ForceBootstrap -ErrorAction SilentlyConti
$providerBootstrapParams.Add('AllowPrerelease', $true)
}

Write-Information "Bootstrap: Installing NuGet Package Provider from the web (Make sure Microsoft addresses/ranges are allowed)"
Write-Information 'Bootstrap: Installing NuGet Package Provider from the web (Make sure Microsoft addresses/ranges are allowed)'
$null = Install-PackageProvider @providerBootstrapParams
$latestNuGetVersion = (Get-PackageProvider -Name NuGet -ListAvailable | Select-Object -First 1).Version.ToString()
Write-Information "Bootstrap: Importing NuGet Package Provider version $latestNuGetVersion to current session."
$Null = Import-PackageProvider -Name NuGet -RequiredVersion $latestNuGetVersion -Force
}

Write-Progress -Activity "Bootstrap:" -PercentComplete 10 -CurrentOperation "Ensuring Gallery $Gallery is trusted"
Write-Progress -Activity 'Bootstrap:' -PercentComplete 10 -CurrentOperation "Ensuring Gallery $Gallery is trusted"

# Fail if the given PSGallery is not Registered
$Policy = (Get-PSRepository $Gallery -ErrorAction Stop).InstallationPolicy
Set-PSRepository -Name $Gallery -InstallationPolicy Trusted -ErrorAction Ignore
try
{
Write-Progress -Activity "Bootstrap:" -PercentComplete 25 -CurrentOperation "Checking PowerShellGet"
Write-Progress -Activity 'Bootstrap:' -PercentComplete 25 -CurrentOperation 'Checking PowerShellGet'
# Ensure the module is loaded and retrieve the version you have
$PowerShellGetVersion = (Import-Module PowerShellGet -PassThru -ErrorAction SilentlyContinue).Version

Write-Verbose "Bootstrap: The PowerShellGet version is $PowerShellGetVersion"
# Versions below 1.6.0 are considered old, unreliable & not recommended
if (!$PowerShellGetVersion -or ($PowerShellGetVersion -lt [System.version]'1.6.0' -and !$AllowOldPowerShellGetModule))
{
Write-Progress -Activity "Bootstrap:" -PercentComplete 40 -CurrentOperation "Installing newer version of PowerShellGet"
Write-Progress -Activity 'Bootstrap:' -PercentComplete 40 -CurrentOperation 'Installing newer version of PowerShellGet'
$InstallPSGetParam = @{
Name = 'PowerShellGet'
Force = $True
Expand All @@ -177,11 +177,11 @@ try
}

Install-Module @InstallPSGetParam
Remove-Module PowerShellGet -force -ErrorAction SilentlyContinue
Remove-Module PowerShellGet -Force -ErrorAction SilentlyContinue
Import-Module PowerShellGet -Force
$NewLoadedVersion = (Get-Module PowerShellGet).Version.ToString()
Write-Information "Bootstrap: PowerShellGet version loaded is $NewLoadedVersion"
Write-Progress -Activity "Bootstrap:" -PercentComplete 60 -CurrentOperation "Installing newer version of PowerShellGet"
Write-Progress -Activity 'Bootstrap:' -PercentComplete 60 -CurrentOperation 'Installing newer version of PowerShellGet'
}

# Try to import the PSDepend module from the available modules
Expand Down Expand Up @@ -220,7 +220,7 @@ try
$InstallPSDependParam.add('MinimumVersion', $MinimumPSDependVersion)
}

Write-Progress -Activity "Bootstrap:" -PercentComplete 75 -CurrentOperation "Installing PSDepend from $Gallery"
Write-Progress -Activity 'Bootstrap:' -PercentComplete 75 -CurrentOperation "Installing PSDepend from $Gallery"
Install-Module @InstallPSDependParam
}
else
Expand All @@ -237,13 +237,13 @@ try
$SaveModuleParam.add('MinimumVersion', $MinimumPSDependVersion)
}

Write-Progress -Activity "Bootstrap:" -PercentComplete 75 -CurrentOperation "Saving & Importing PSDepend from $Gallery to $Scope"
Write-Progress -Activity 'Bootstrap:' -PercentComplete 75 -CurrentOperation "Saving & Importing PSDepend from $Gallery to $Scope"
Save-Module @SaveModuleParam
}
}
finally
{
Write-Progress -Activity "Bootstrap:" -PercentComplete 100 -CurrentOperation "Loading PSDepend"
Write-Progress -Activity 'Bootstrap:' -PercentComplete 100 -CurrentOperation 'Loading PSDepend'
# We should have successfully bootstrapped PSDepend. Fail if not available
Import-Module PSDepend -ErrorAction Stop
}
Expand All @@ -260,15 +260,15 @@ try
}

Save-Module @SaveModuleParam
Import-Module "PowerShell-Yaml" -ErrorAction Stop
Import-Module 'PowerShell-Yaml' -ErrorAction Stop
}
else
{
Write-Verbose "PowerShell-Yaml is already available"
Write-Verbose 'PowerShell-Yaml is already available'
}
}

Write-Progress -Activity "PSDepend:" -PercentComplete 0 -CurrentOperation "Restoring Build Dependencies"
Write-Progress -Activity 'PSDepend:' -PercentComplete 0 -CurrentOperation 'Restoring Build Dependencies'
if (Test-Path $DependencyFile)
{
$PSDependParams = @{
Expand All @@ -279,11 +279,11 @@ try
# TODO: Handle when the Dependency file is in YAML, and -WithYAML is specified
Invoke-PSDepend @PSDependParams
}
Write-Progress -Activity "PSDepend:" -PercentComplete 100 -CurrentOperation "Dependencies restored" -Completed
Write-Progress -Activity 'PSDepend:' -PercentComplete 100 -CurrentOperation 'Dependencies restored' -Completed
}
finally
{
# Reverting the Installation Policy for the given gallery
Set-PSRepository -Name $Gallery -InstallationPolicy $Policy
Write-Verbose "Project Bootstrapped, returning to Invoke-Build"
Write-Verbose 'Project Bootstrapped, returning to Invoke-Build'
}
1 change: 0 additions & 1 deletion Resolve-Dependency.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
AllowPrerelease = $false
WithYAML = $true # Will also bootstrap PowerShell-Yaml to read other config files
}

1 change: 0 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

os: WMF 5

build: false
Expand Down

0 comments on commit 82de9ce

Please sign in to comment.