feat(Resolve-ProjectParameters): Remove sticky project environment setting#199
feat(Resolve-ProjectParameters): Remove sticky project environment setting#199
Conversation
…meters from environment
… call to use default parameters
…al DoNotThrow switch
…eters in multiple files
…eters in multiple functions
…eters in multiple files
…eters in project item sync and issue creation scripts
…ectParameters.ps1
| @@ -0,0 +1,59 @@ | |||
| function Resolve-ProjectParameters { | |||
Check warning
Code scanning / PSScriptAnalyzer
The cmdlet 'Resolve-ProjectParameters' uses a plural noun. A singular noun should be used instead. Warning
| return ($Owner, $ProjectNumber) | ||
| } | ||
|
|
||
| function Test-ProjectParameters { |
Check warning
Code scanning / PSScriptAnalyzer
The cmdlet 'Test-ProjectParameters' uses a plural noun. A singular noun should be used instead. Warning
| return -not ([string]::IsNullOrWhiteSpace($Owner) -or [string]::IsNullOrWhiteSpace($ProjectNumber)) | ||
| } | ||
|
|
||
| function Set-ProjectParameters { |
Check warning
Code scanning / PSScriptAnalyzer
Function 'Set-ProjectParameters' has verb that could change system state. Therefore, the function has to support 'ShouldProcess'. Warning
| return -not ([string]::IsNullOrWhiteSpace($Owner) -or [string]::IsNullOrWhiteSpace($ProjectNumber)) | ||
| } | ||
|
|
||
| function Set-ProjectParameters { |
Check warning
Code scanning / PSScriptAnalyzer
The cmdlet 'Set-ProjectParameters' uses a plural noun. A singular noun should be used instead. Warning
| function Test_AddComment_SUCCESS_Using_Direct{ | ||
|
|
||
| $p = Get-Mock_Project_700 | ||
| $p = Get-Mock_Project_700 |
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
|
|
||
| # Act | ||
| $result = Get-ProjectIssue -Url $i.url | ||
| $result = Get-ProjectIssue -Url $i.url |
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
|
|
||
| ($Owner, $ProjectNumber) = Resolve-ProjectParameters -Owner $Owner -ProjectNumber $ProjectNumber -DoNotThrow | ||
|
|
||
| return -not ([string]::IsNullOrWhiteSpace($Owner) -or [string]::IsNullOrWhiteSpace($ProjectNumber)) |
Check notice
Code scanning / PSScriptAnalyzer
The cmdlet 'Test-ProjectParameters' returns an object of type 'System.Boolean' but this type is not declared in the OutputType attribute. Note
| return -not ([string]::IsNullOrWhiteSpace($Owner) -or [string]::IsNullOrWhiteSpace($ProjectNumber)) | ||
| } | ||
|
|
||
| function Set-ProjectParameters { |
Check notice
Code scanning / PSScriptAnalyzer
The cmdlet 'Set-ProjectParameters' does not have a help comment. Note
| throw "Issue not removed properly" | ||
| # Check that issue was part of the returned repo url | ||
| if($issue.url.StartsWith($repourl)){ | ||
| return $true |
Check notice
Code scanning / PSScriptAnalyzer
The cmdlet 'Remove-IssueDirect' returns an object of type 'System.Boolean' but this type is not declared in the OutputType attribute. Note
|
|
||
| # Find Item to remove | ||
| $item = Get-ProjectItem -ItemId $ItemId | ||
| $item = Get-ProjectItem -ItemId $ItemId -Owner $Owner -ProjectNumber $ProjectNumber |
Check notice
Code scanning / PSScriptAnalyzer
Line has trailing whitespace Note
Before when running a command with owner and ProjectNumber parametesr it will cache the parameters for later use.
We have removed this sticky cache and force to call Set-ProjectParameter to make owner and PN parameters values defaut.
This allows a user to work across two projects easilly