Skip to content

Comments

Refactor: code quality improvements, documentation fixes, and Pester tests#13

Merged
leonardokr merged 7 commits intomainfrom
improve/code-quality-and-docs
Feb 18, 2026
Merged

Refactor: code quality improvements, documentation fixes, and Pester tests#13
leonardokr merged 7 commits intomainfrom
improve/code-quality-and-docs

Conversation

@leonardokr
Copy link
Owner

@leonardokr leonardokr commented Feb 18, 2026

Summary

Comprehensive quality improvements across the entire repository.

Code Quality

  • Replace @() += anti-pattern with List<PSObject> in 3 scripts
  • Modernize New-Object to [PSCustomObject] in Get-FolderPermissions
  • Add SupportsShouldProcess to Remove-OrphanedProfiles for destructive operations
  • Parameterize FullAccess "Everyone" in New-ShareAndDFS (new -ShareAccess param)
  • Add #Requires -Modules ActiveDirectory to Get-DeletedUsers and Get-UserLastLogon
  • Add Version: 1.0.0 to .NOTES in all 8 scripts
  • Clean up trailing blank lines across all scripts

Documentation

  • Add CI status badge to root README
  • Fix missing .ps1 extension for Send-PasswordExpiryNotification in root README
  • Add Invoke-WindowsUpdateMaintenance to root README
  • Fix broken Markdown code fence in ActiveDirectory/README.md
  • Fix SystemMaintenance -> System in CONTRIBUTING.md
  • Add maintainer contact link to SECURITY.md
  • Document sample-servers.csv in System/README.md

Testing

  • Add Tests/ScriptValidation.Tests.ps1 with Pester test suite
  • Tests validate: syntax, help documentation, coding standards, parameter declarations
  • Add Pester to CI pipeline

Code quality improvements:
- Replace @() += anti-pattern with List<PSObject> in Get-FolderPermissions,
  New-ShareAndDFS, and Deploy-ScheduledTasks
- Modernize New-Object to [PSCustomObject] in Get-FolderPermissions
- Add SupportsShouldProcess to Remove-OrphanedProfiles for destructive ops
- Parameterize FullAccess "Everyone" in New-ShareAndDFS (-ShareAccess)
- Add #Requires -Modules ActiveDirectory to Get-DeletedUsers and Get-UserLastLogon
- Add Version field (1.0.0) to .NOTES in all scripts
- Add explanatory comment for group name regex in Get-UserLastLogon
- Clean up trailing blank lines across all scripts

Documentation fixes:
- Add CI status badge to root README
- Fix missing .ps1 extension for Send-PasswordExpiryNotification in README
- Add Invoke-WindowsUpdateMaintenance to root README System section
- Fix broken Markdown code fence in ActiveDirectory/README.md
- Update ActiveDirectory/README.md examples for new PascalCase params
- Fix CONTRIBUTING.md category SystemMaintenance -> System, add Registry
- Add maintainer contact link to SECURITY.md
- Document sample-servers.csv in System/README.md
- Update NetworkShares/README.md to mention -ShareAccess parameter

Testing:
- Add Tests/ directory with Pester test suite (ScriptValidation.Tests.ps1)
- Tests validate syntax, help docs, coding standards, and param declarations
- Add Pester to CI pipeline
…AndDFS

After merging the bug fix PR, EnableDebugMode is now properly used in
the script, making the PSReviewUnusedParameter suppression unnecessary
and causing a DiagnosticRecord error in PSScriptAnalyzer.
PSScriptAnalyzer cannot detect usage of ShareAccess inside the nested
New-ShareFolder function scope. Adding targeted suppression.
Split by \r?\n instead of \n and match only spaces/tabs (not \r) to
avoid false positives from carriage returns on Windows.
- Add missing comma after ShareAccess param in New-ShareAndDFS (syntax error)
- Add Version to NOTES in Send-PasswordExpiryNotification and Invoke-WindowsUpdateMaintenance
- Remove trailing whitespace in Invoke-WindowsUpdateMaintenance and Remove-OrphanedProfiles
PSScriptAnalyzer cannot detect usage of EnableDebugMode inside the
nested Write-ScriptLog function scope. Re-adding targeted suppression.
@leonardokr leonardokr merged commit 4180818 into main Feb 18, 2026
1 check 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.

1 participant