Skip to content

Refactor input validation in New-AsBuiltConfig, New-AsBuiltReport, and New-AsBuiltReportConfig scripts#73

Merged
tpcarman merged 4 commits intoAsBuiltReport:devfrom
rebelinux:dev
May 6, 2026
Merged

Refactor input validation in New-AsBuiltConfig, New-AsBuiltReport, and New-AsBuiltReportConfig scripts#73
tpcarman merged 4 commits intoAsBuiltReport:devfrom
rebelinux:dev

Conversation

@rebelinux
Copy link
Copy Markdown
Contributor

Refactor input validation in New-AsBuiltConfig, New-AsBuiltReport, and New-AsBuiltReportConfig scripts

  • Updated string comparisons from "" to '' for consistency and clarity.
  • Enhanced validation logic for user inputs in various prompts to ensure default values are set correctly.
  • Excluded 'AsBuiltReport.Chart' and 'AsBuiltReport.Diagram' from the list of installed report modules in multiple locations to streamline report generation.

…d New-AsBuiltReportConfig scripts

- Updated string comparisons from `""` to `''` for consistency and clarity.
- Enhanced validation logic for user inputs in various prompts to ensure default values are set correctly.
- Excluded 'AsBuiltReport.Chart' and 'AsBuiltReport.Diagram' from the list of installed report modules in multiple locations to streamline report generation.
Copilot AI review requested due to automatic review settings April 4, 2026 18:36
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 4, 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors interactive input validation and report-module discovery in the New-AsBuiltConfig, New-AsBuiltReport, and New-AsBuiltReportConfig PowerShell entrypoints, while also updating workflow tooling and standardizing quoting.

Changes:

  • Excludes AsBuiltReport.Chart and AsBuiltReport.Diagram from discovered report modules (validation + argument completers).
  • Normalizes string literals to single quotes in multiple scripts and style assets.
  • Bumps the Bluesky release-post GitHub Action version in the release workflow.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
AsBuiltReport.Core/Src/Public/New-AsBuiltReportConfig.ps1 Filters module discovery to omit Chart/Diagram and updates quoting in validation/completer logic.
AsBuiltReport.Core/Src/Public/New-AsBuiltReport.ps1 Filters available report modules, normalizes quoting, and adjusts message output code paths.
AsBuiltReport.Core/Src/Public/New-AsBuiltConfig.ps1 Normalizes empty-string checks and defaulting behavior in interactive prompts.
AsBuiltReport.Core/AsBuiltReport.Core.Style.ps1 Switches embedded Base64 image string to single-quoted literal.
.github/workflows/Release.yml Updates zentered/bluesky-post-action from v0.3.0 to v0.4.0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread AsBuiltReport.Core/Src/Public/New-AsBuiltReport.ps1 Outdated
Comment thread AsBuiltReport.Core/Src/Public/New-AsBuiltReport.ps1 Outdated
# Find the root folder where the module is located for the report that has been specified
try {
$Module = Get-Module -Name "AsBuiltReport.$Report" -ListAvailable | Where-Object { $_.name -ne 'AsBuiltReport.Core' } | Sort-Object -Property Version -Descending | Select-Object -Unique
$Module = Get-Module -Name "AsBuiltReport.$Report" -ListAvailable | Where-Object { $_.name -ne 'AsBuiltReport.Core' -and $_.name -ne 'AsBuiltReport.Chart' -and $_.name -ne 'AsBuiltReport.Diagram' } | Sort-Object -Property Version -Descending | Select-Object -Unique
Copy link

Copilot AI Apr 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Get-Module ... | Sort-Object Version -Descending | Select-Object -Unique can still return multiple module versions (because different versions are distinct objects), which makes $Module an array. That can lead to incorrect path building / truthy array behavior in if (Test-Path ...) and confusing output. Prefer selecting a single module (e.g., take the first after sorting) to ensure $Module.ModuleBase and $Module.Name are scalars.

Suggested change
$Module = Get-Module -Name "AsBuiltReport.$Report" -ListAvailable | Where-Object { $_.name -ne 'AsBuiltReport.Core' -and $_.name -ne 'AsBuiltReport.Chart' -and $_.name -ne 'AsBuiltReport.Diagram' } | Sort-Object -Property Version -Descending | Select-Object -Unique
$Module = Get-Module -Name "AsBuiltReport.$Report" -ListAvailable | Where-Object { $_.name -ne 'AsBuiltReport.Core' -and $_.name -ne 'AsBuiltReport.Chart' -and $_.name -ne 'AsBuiltReport.Diagram' } | Sort-Object -Property Version -Descending | Select-Object -First 1

Copilot uses AI. Check for mistakes.
tpcarman and others added 2 commits May 6, 2026 14:14
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@tpcarman tpcarman merged commit 434ae6b into AsBuiltReport:dev May 6, 2026
5 of 8 checks passed
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.

3 participants