PSRAFSCAN DOCUMENTATION
Choose Ps1File or TerminalPaste
Choose Ps1File for a saved PowerShell script or TerminalPaste for live terminal input, and understand the six paste-specific checks.
Make the choice
Save and run the code as a file? Choose Ps1File. Enter the code directly into a terminal? Choose TerminalPaste.
Compare the contexts
| Feature | Ps1File | TerminalPaste |
|---|---|---|
| Source | One saved .ps1 file | Input handled by a terminal host and line editor |
| Top-level param() | Binds values when the script is invoked | A direct paste has no script-file invocation |
| #Requires | Declares prerequisites for the script | Use explicit checks or keep the code as a script |
| Script-path variables | $PSScriptRoot and $PSCommandPath describe the running file | No executing .ps1 path exists |
| Multiline input | The parser receives the complete file | The host decides when the interactive input is complete |
Six checks are specific to TerminalPaste
PSRafScan 0.2.0-alpha1 applies 52 rules in both modes and adds these six for TerminalPaste:
FunctionInsidePasteWrapperPasteSensitiveContinuationBlockPasteSensitiveDoWhileRequiresInTerminalPasteScriptFileVariableInTerminalPasteTopLevelParamInTerminalPaste
Terminal behavior can vary
Interactive behavior can change with the terminal, PowerShell host, line editor, version, edit mode, and paste method.
RSX -Path ./saved-script.ps1 -IntendedUse Ps1File -FailOn Warning
RSX -Path ./paste-candidate.ps1 -IntendedUse TerminalPaste -FailOn Warning