Open ThomasNieto opened 1 year ago
I don't think there was a particular reason other than ask user to be explicit but I'd be ok with having such a default.
Thanks @ThomasNieto could you please elaborate on the usability concern...this required path is a pattern in PowerShell...it also could be costly to run PSSA on the . path
@SydneyhSmith because PowerShell best practices is to use a default value over a required parameter when a reasonable default value can be derived from expected use. I would think a common use case for any PowerShell cmdlet and PSSA included is to default to the current working directory.
I don't understand your "costly" statement. Please explain why it is "costly" to run the script analyzer in the current working directory? PSSA defaults to not running recursively. We're not talking about defaulting to the Windows directory with Recurse enabled.
Specifically my use case I ran into is trying to run PSSA in a GitHub action and since GitHub actions current working directory is the GitHub project I would have expected that it would "just work" but it didn't and upon inspecting it was due to this required parameter.
There is no issue from my prospective changing it to be a default value. All existing users have already defined the required path parameter and new users can make use of the default if they so desire.
I still agree with Thomas and he has good arguments like Recurse not being the default. Can you give examples Sydney where Path is explicitly required but not necessary (Test-Path is not an example as Path parameter is necessary for it)? At first I was sceptical around not being explicit but then I looked at cmdlets like Get-ChildItem or Invoke-Pester that default to current working directory as well
Closing due to inactivity
@bergmeister / @SydneyhSmith why was this closed?
The bot did it because of the 'Need repro info' tag
The required
-Path
parameter is a usability concern. It should default to.
removing the need for the required parameter.Is there a reason or design choice of why this parameter is required without a default value?
Steps to reproduces
Expected behavior
Actual behavior
If an unexpected error was thrown then please report the full error details using e.g.
$error[0] | Select-Object *
Environment data