Skip to content

Commit

Permalink
Migrate to Pester 5 (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-hughes authored Aug 19, 2024
1 parent 2552eeb commit 0c82376
Show file tree
Hide file tree
Showing 121 changed files with 21,833 additions and 14,628 deletions.
File renamed without changes.
39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE/03_command_proposal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: New command proposal
description: If you have a proposal for a new public command that you think should be added to this module. The new command that is proposed shall be able to be used by a new or existing resource.
title: "NewCommandName: New command proposal"
labels: []
assignees: []
body:
- type: markdown
attributes:
value: |
Please replace `NewCommandName` in the issue title (above) with your proposed command name.
Thank you for contributing and making this module better!
- type: textarea
id: description
attributes:
label: Command proposal
description: Provide information how this command will/should work and how it will help users.
validations:
required: true
- type: textarea
id: proposedParameters
attributes:
label: Proposed parameters
description: |
List all the proposed parameters and any parameter sets that the command should have. For each parameter provide a detailed description, the data type, if a default value should be used, and if the property is limited to a set of values.
value: |
Parameter | Mandatory | Data type | Description | Default value | Allowed values
--- | --- | --- | --- | --- | ---
ParameterName | Yes | String | Detailed description | None | None
validations:
required: true
- type: textarea
id: considerations
attributes:
label: Special considerations or limitations
description: |
Provide any considerations or limitations you can think of that a contributor should take in account when coding the proposed command, and or what limitations a user will encounter or should consider when using the proposed command.
validations:
required: true
101 changes: 101 additions & 0 deletions .github/ISSUE_TEMPLATE/05_problem_with_command.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Problem with a command
description: If you want to report a bug or suggest an enhancement to a public command in this module.
labels: []
assignees: []
body:
- type: markdown
attributes:
value: |
TITLE: Please be descriptive not sensationalist.
Your feedback and support is greatly appreciated, thanks for contributing!
Please provide information regarding your issue under each section below.
**Write N/A in sections that do not apply, or if the information is not available.**
- type: textarea
id: description
attributes:
label: Problem description
description: Details of the scenario you tried and the problem that is occurring, or the enhancement you are suggesting.
validations:
required: true
- type: textarea
id: logs
attributes:
label: Verbose logs
description: |
Verbose logs showing the problem. **NOTE! Sensitive information should be obfuscated.** _Will be automatically formatted as plain text._
placeholder: |
Paste verbose logs here
render: text
validations:
required: true
- type: textarea
id: reproducible
attributes:
label: How to reproduce
description: Provide the steps to reproduce the problem.
validations:
required: true
- type: textarea
id: expectedBehavior
attributes:
label: Expected behavior
description: Describe what you expected to happen.
validations:
required: true
- type: textarea
id: currentBehavior
attributes:
label: Current behavior
description: Describe what actually happens.
validations:
required: true
- type: textarea
id: suggestedSolution
attributes:
label: Suggested solution
description: Do you have any suggestions how to solve the issue?
validations:
required: true
- type: textarea
id: targetNodeOS
attributes:
label: Operating system the target node is running
description: |
Please provide as much as possible about the node running the command. _Will be automatically formatted as plain text._
To help with this information:
- On a Linux distribution, please provide the distribution name, version, and release. The following command can help get this information: `cat /etc/*-release && cat /proc/version`
- On a Windows OS please provide edition, version, build, and language. The following command can help get this information: `Get-ComputerInfo -Property @('OsName','OsOperatingSystemSKU','OSArchitecture','WindowsVersion','WindowsBuildLabEx','OsLanguage','OsMuiLanguages')`
placeholder: |
Add operating system information here
render: text
validations:
required: true
- type: textarea
id: targetNodePS
attributes:
label: PowerShell version and build the target node is running
description: |
Please provide the version and build of PowerShell the target node is running. _Will be automatically formatted as plain text._
To help with this information, please run this command: `$PSVersionTable`
placeholder: |
Add PowerShell information here
render: text
validations:
required: true
- type: textarea
id: moduleVersion
attributes:
label: Module version used
description: |
Please provide the version of the module that was used. _Will be automatically formatted as plain text._
To help with this information, please run this command where you encountered the problem: `Get-Module -Name 'DnsServerDsc' -ListAvailable | ft Name,Version,Path`
placeholder: |
Add module information here
render: text
validations:
required: true
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ contact_links:
- name: "Virtual PowerShell User Group #DSC channel"
url: https://dsccommunity.org/community/contact/
about: "To talk to the community and maintainers of DSC Community, please visit the #DSC channel."

147 changes: 109 additions & 38 deletions .vscode/analyzersettings.psd1
Original file line number Diff line number Diff line change
@@ -1,44 +1,115 @@
@{
CustomRulePath = '.\output\RequiredModules\DscResource.AnalyzerRules'
includeDefaultRules = $true
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',
CustomRulePath = @(
'./output/RequiredModules/DscResource.AnalyzerRules'
'./output/RequiredModules/Indented.ScriptAnalyzerRules'
)
IncludeDefaultRules = $true
IncludeRules = @(
# DSC Community style guideline rules from the module ScriptAnalyzer.
'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'

# Additional rules from the module ScriptAnalyzer
'PSUseConsistentWhitespace'
'UseCorrectCasing'
'PSPlaceOpenBrace'
'PSPlaceCloseBrace'
'AlignAssignmentStatement'
'AvoidUsingDoubleQuotesForConstantString'
'UseShouldProcessForStateChangingFunctions'

# Rules from the modules DscResource.AnalyzerRules
'Measure-*'

# Rules from the module Indented.ScriptAnalyzerRules
'AvoidCreatingObjectsFromAnEmptyString'
'AvoidDashCharacters'
'AvoidEmptyNamedBlocks'
'AvoidFilter'
'AvoidHelpMessage'
'AvoidNestedFunctions'
'AvoidNewObjectToCreatePSObject'
'AvoidParameterAttributeDefaultValues'
'AvoidProcessWithoutPipeline'
'AvoidSmartQuotes'
'AvoidThrowOutsideOfTry'
'AvoidWriteErrorStop'
'AvoidWriteOutput'
'UseSyntacticallyCorrectExamples'
)

<#
The following types are not rules but parse errors reported by PSScriptAnalyzer
so they cannot be ecluded. They need to be filtered out from the result of
Invoke-ScriptAnalyzer.
TypeNotFound - Because classes in the project cannot be found unless built.
RequiresModuleInvalid - Because 'using module' in prefix.ps1 cannot be resolved as source file.
#>
ExcludeRules = @()

Rules = @{
PSUseConsistentWhitespace = @{
Enable = $true
CheckOpenBrace = $true
CheckInnerBrace = $true
CheckOpenParen = $true
CheckOperator = $false
CheckSeparator = $true
CheckPipe = $true
CheckPipeForRedundantWhitespace = $true
CheckParameter = $false
}

PSPlaceOpenBrace = @{
Enable = $true
OnSameLine = $false
NewLineAfter = $true
IgnoreOneLineBlock = $false
}

PSPlaceCloseBrace = @{
Enable = $true
NoEmptyLineBefore = $true
IgnoreOneLineBlock = $false
NewLineAfter = $true
}

PSAlignAssignmentStatement = @{
Enable = $true
CheckHashtable = $true
}
}
}
23 changes: 20 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,22 @@
"powershell.codeFormatting.whitespaceAroundOperator": true,
"powershell.codeFormatting.whitespaceAfterSeparator": true,
"powershell.codeFormatting.ignoreOneLineBlock": false,
"powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationAfterEveryPipeline",
"powershell.codeFormatting.pipelineIndentationStyle": "IncreaseIndentationForFirstPipeline",
"powershell.codeFormatting.preset": "Custom",
"powershell.codeFormatting.alignPropertyValuePairs": true,
"powershell.codeFormatting.useConstantStrings": true,
"powershell.developer.bundledModulesPath": "${cwd}/output/RequiredModules",
"powershell.scriptAnalysis.settingsPath": ".vscode\\analyzersettings.psd1",
"powershell.scriptAnalysis.settingsPath": "/.vscode/analyzersettings.psd1",
"powershell.scriptAnalysis.enable": true,
"files.trimTrailingWhitespace": true,
"files.trimFinalNewlines": true,
"files.insertFinalNewline": true,
"files.associations": {
"*.ps1xml": "xml"
},
"cSpell.dictionaries": [
"powershell"
],
"cSpell.words": [
"COMPANYNAME",
"ICONURI",
Expand All @@ -34,8 +38,21 @@
"pscmdlet",
"steppable"
],
"cSpell.ignorePaths": [
".git"
],
"[markdown]": {
"files.trimTrailingWhitespace": true,
"files.encoding": "utf8"
}
},
"powershell.pester.useLegacyCodeLens": false,
"pester.testFilePath": [
"[tT]ests/[qQ][aA]/*.[tT]ests.[pP][sS]1",
"[tT]ests/[uU]nit/**/*.[tT]ests.[pP][sS]1",
"[tT]ests/[uU]nit/*.[tT]ests.[pP][sS]1"
],
"pester.runTestsInNewProcess": true,
"pester.pesterModulePath": "./output/RequiredModules/Pester",
"powershell.pester.codeLens": true,
"pester.suppressCodeLensNotice": true
}
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Update to use the build worker `windows-latest` for the necessary stages
of the pipeline, and `ubuntu-latest` for the other stages.
- Update pipeline to use _GitVersion.Tool_ installed by `dotnet`.
- Update unit and integration tests to Pester 5
- DnsServer* Class Resources
- Used `DscResource.Base`
- BREAKING: Added `Reasons` property as population of this is builtin
to base class.
- Updated `prefix`, `build`, `RequiredModules` for Pester 5 and
DscResource.Base usage.
- Added tests for `DSC_DnsServerSecondaryZone`.
- Updated project related files
- `.github/ISSUE_TEMPLATES`
- `.vscode`
- `ResolveDependency.ps1`
- `build.ps1`
- DnsServerDsc.Common
- Added unit tests for `Convert-RootHintsToHashtable`.

Expand All @@ -29,11 +42,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Removed unit tests for functions no longer part of the module.
- Removed functions from the module manifest that are no longer
part of the module.
- Pin `gitversion` version in `azure-pipelines`
- DnRecordBase
- Update comment regarding use of `using module` statement.
- ResourceBase
- Update comment regarding use of `using module` statement.

### Removed

- DnsServerDsc
- Removed `001.ResourceBase` and replaced with `DscResource.Base`.
- Removed `Get-ClassName` and `Get-LocalizedDataRecursive` utilizing
ones provided in `DscResource.Base`.

## [3.0.0] - 2021-05-26

### Removed
Expand Down
4 changes: 2 additions & 2 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mode: ContinuousDelivery
next-version: 0.0.1
major-version-bump-message: '(breaking\schange|breaking|major)\b'
minor-version-bump-message: '(adds?|features?|minor)\b'
major-version-bump-message: '(breaking\schange|breaking)\b'
minor-version-bump-message: '(adds?|minor)\b'
patch-version-bump-message: '\s?(fix|patch)'
no-bump-message: '\+semver:\s?(none|skip)'
assembly-informational-format: '{NuGetVersionV2}+Sha.{Sha}.Date.{CommitDate}'
Expand Down
Loading

0 comments on commit 0c82376

Please sign in to comment.