Skip to content

style: add ValidateNotNullOrEmpty to build.ps1 -Task parameter#20

Merged
tablackburn merged 1 commit into
mainfrom
style/validate-task-not-null-or-empty
May 12, 2026
Merged

style: add ValidateNotNullOrEmpty to build.ps1 -Task parameter#20
tablackburn merged 1 commit into
mainfrom
style/validate-task-not-null-or-empty

Conversation

@tablackburn

@tablackburn tablackburn commented May 12, 2026

Copy link
Copy Markdown
Owner

Summary

Adds [ValidateNotNullOrEmpty()] to the $Task parameter in build.ps1 to match the canonical pattern from PowerShellModuleTemplate#23.

Without the validator, ./build.ps1 -Task '' and ./build.ps1 -Task $null` slip past parameter binding and produce confusing downstream errors from psake. The validator surfaces the misuse immediately.

Test plan

  • ./build.ps1 still runs successfully (default 'default' task)
  • ./build.ps1 -Task '' fails fast with a parameter-validation error

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Enhanced build script parameter validation to ensure more reliable builds.

Review Change Stack

Matches the canonical template (PowerShellModuleTemplate#23). Without
the validator, `./build.ps1 -Task ''` and `./build.ps1 -Task $null` slip
past parameter binding and produce confusing downstream errors from
psake. The validator surfaces the misuse immediately.
Copilot AI review requested due to automatic review settings May 12, 2026 02:24
@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7c1c81d3-8d5c-4e36-943d-831b2d5cfa47

📥 Commits

Reviewing files that changed from the base of the PR and between 334e36d and 3c2997d.

📒 Files selected for processing (1)
  • build.ps1

📝 Walkthrough

Walkthrough

The build.ps1 script's Task parameter now includes a [ValidateNotNullOrEmpty()] validation attribute to enforce that callers provide a non-empty task name before execution.

Changes

Build Script Parameter Validation

Layer / File(s) Summary
Task parameter validation
build.ps1
The Task parameter declaration adds [ValidateNotNullOrEmpty()] to require a non-null, non-empty value at script invocation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A single line, so short and sweet,
Validation makes the build complete!
No empty tasks shall pass on through,
The rabbit approves—this change is true! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main change: adding ValidateNotNullOrEmpty validation to the Task parameter in build.ps1.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch style/validate-task-not-null-or-empty

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown

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 improves build.ps1 argument validation by adding [ValidateNotNullOrEmpty()] to the -Task parameter, so invalid invocations fail immediately during parameter binding rather than producing confusing downstream psake errors.

Changes:

  • Add [ValidateNotNullOrEmpty()] to the build.ps1 -Task parameter to reject '' and $null inputs earlier.

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

@tablackburn tablackburn merged commit 0fe6100 into main May 12, 2026
16 checks passed
@tablackburn tablackburn deleted the style/validate-task-not-null-or-empty branch May 12, 2026 02:32
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