Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 16, 2025

Addressed Codacy/PSScriptAnalyzer feedback on PR #15 identifying code quality issues and an unused parameter.

Changes

  • Renamed Write-LogWrite-MaintenanceLog: Avoids conflict with built-in cmdlet in PowerShell Core 6.1+
  • Added [CmdletBinding(SupportsShouldProcess)] to Invoke-Step: Function calls ShouldProcess and requires attribute
  • Removed unused DestructiveMode parameter: Parameter was declared but never referenced in script logic
  • Updated tests: Removed test case for removed parameter (19 tests passing)

Impact

All PSScriptAnalyzer warnings resolved. Script behavior unchanged—destructive operations continue to use ShouldProcess with -WhatIf and -Confirm support as before.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Nov 16, 2025
Copilot AI changed the title [WIP] Fix PowerShell test issues and incorporate feedback Fix PSScriptAnalyzer warnings and remove unused parameter Nov 16, 2025
Copilot AI requested a review from AprilDeFeu November 16, 2025 00:33
@AprilDeFeu AprilDeFeu marked this pull request as ready for review November 16, 2025 00:36
Copilot AI review requested due to automatic review settings November 16, 2025 00:36
Copy link
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

This PR addresses PSScriptAnalyzer warnings identified in PR #15 by making three key improvements to the PowerShell system maintenance script: renaming a function to avoid naming conflicts, adding proper cmdlet binding attributes, and removing an unused parameter.

  • Renamed Write-Log to Write-MaintenanceLog to prevent conflicts with PowerShell Core 6.1+ built-in cmdlets
  • Added [CmdletBinding(SupportsShouldProcess)] attribute to Invoke-Step function to properly support -WhatIf and -Confirm parameters
  • Removed the unused DestructiveMode parameter and its associated documentation

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
PowerShell/system-administration/maintenance/system-maintenance.ps1 Updated function name from Write-Log to Write-MaintenanceLog (12 occurrences), added [CmdletBinding(SupportsShouldProcess)] to Invoke-Step, removed DestructiveMode parameter and related documentation
tests/unit/PowerShell/system-maintenance.Tests.ps1 Removed test case for the deleted DestructiveMode parameter

@AprilDeFeu AprilDeFeu merged commit aad1413 into feat/testing-framework Nov 16, 2025
1 check passed
@AprilDeFeu AprilDeFeu deleted the copilot/sub-pr-15-again branch November 16, 2025 00:42
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.

2 participants