Skip to content
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

Standardize container name and type validation #2379

Merged
merged 6 commits into from Apr 29, 2024

Conversation

fflaten
Copy link
Collaborator

@fflaten fflaten commented Jul 15, 2023

PR Summary

This PR adds a Name-property to Container-objects to standardize naming currently set in multiple places.

There was two variations in the codebase when container type was File:

  • $Item.ToString() which is FullName in PS7, but Name in Windows PowerShell
  • $Item.FullName

After PR: Prefer FullName if FileInfo-object for consistency, else ToString().

There was two variations in the codebase when the scriptblock was linked to a file:

  • <ScriptBlock>file:line
  • <ScriptBlock>:file:line

After PR: <ScriptBlock>:file:line

PR also moves container type validation to property setter to avoid checking in multiple places.

PR Checklist

  • PR has meaningful title
  • Summary describes changes
  • PR is ready to be merged
    • If not, use the arrow next to Create Pull Request to mark it as a draft. PR can be marked Ready for review when it's ready.
  • Tests are added/update (if required)
  • Documentation is updated/added (if required)

@fflaten fflaten changed the title Add Name-property to Container Standardize container name and type validation Apr 28, 2024
@@ -306,7 +275,7 @@
function Write-PesterReport {
param (
[Parameter(mandatory = $true, valueFromPipeline = $true)]
$RunResult
[Pester.Run] $RunResult

Check warning

Code scanning / PSScriptAnalyzer

Command accepts pipeline input but has not defined a process block. Warning

Command accepts pipeline input but has not defined a process block.
@@ -85,7 +85,7 @@
#>
param (
[parameter(Mandatory = $true, ValueFromPipeline = $true)]
$Result,
[Pester.Run] $Result,

Check warning

Code scanning / PSScriptAnalyzer

Command accepts pipeline input but has not defined a process block. Warning

Command accepts pipeline input but has not defined a process block.
@@ -135,7 +135,7 @@
#>
param (
[parameter(Mandatory = $true, ValueFromPipeline = $true)]
$Result,
[Pester.Run] $Result,

Check warning

Code scanning / PSScriptAnalyzer

Command accepts pipeline input but has not defined a process block. Warning

Command accepts pipeline input but has not defined a process block.
@@ -147,7 +147,7 @@
function Export-XmlReport {
param (
[parameter(Mandatory = $true, ValueFromPipeline = $true)]
$Result,
[Pester.Run] $Result,

Check warning

Code scanning / PSScriptAnalyzer

Command accepts pipeline input but has not defined a process block. Warning

Command accepts pipeline input but has not defined a process block.
@@ -272,7 +272,7 @@
#>
param (
[parameter(Mandatory = $true, ValueFromPipeline = $true)]
$Result,
[Pester.Run] $Result,

Check warning

Code scanning / PSScriptAnalyzer

Command accepts pipeline input but has not defined a process block. Warning

Command accepts pipeline input but has not defined a process block.
@@ -362,7 +362,7 @@
#>
param (
[parameter(Mandatory = $true, ValueFromPipeline = $true)]
$Result,
[Pester.Run] $Result,

Check warning

Code scanning / PSScriptAnalyzer

Command accepts pipeline input but has not defined a process block. Warning

Command accepts pipeline input but has not defined a process block.
@nohwnd nohwnd merged commit 1a316c3 into pester:main Apr 29, 2024
14 checks passed
@nohwnd
Copy link
Member

nohwnd commented Apr 29, 2024

As always, thank you.

@fflaten fflaten deleted the container-name branch April 29, 2024 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants