Skip to content

Commit 0a4542d

Browse files
authored
Merge pull request #29 from jwittner/dev/scriptAnalyzerFixes
Dev/script analyzer fixes
2 parents eba1f4a + 838809d commit 0a4542d

File tree

3 files changed

+29
-22
lines changed

3 files changed

+29
-22
lines changed

UnitySetup/UnitySetup.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ RequiredModules = @(
6161
# RequiredAssemblies = @()
6262

6363
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
64-
ScriptsToProcess = @("UnitySetupInit.ps1")
64+
ScriptsToProcess = @()
6565

6666
# Type files (.ps1xml) to be loaded when importing this module
6767
# TypesToProcess = @()

UnitySetup/UnitySetup.psm1

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,27 @@
22
# Licensed under the MIT License.
33
Import-Module powershell-yaml -Force -ErrorAction Stop
44

5+
[Flags()]
6+
enum UnitySetupComponentType
7+
{
8+
Setup = (1 -shl 0)
9+
Documentation = (1 -shl 1)
10+
StandardAssets = (1 -shl 2)
11+
ExampleProject = (1 -shl 3)
12+
Metro = (1 -shl 4)
13+
UWP_IL2CPP = (1 -shl 5)
14+
Android = (1 -shl 6)
15+
iOS = (1 -shl 7)
16+
AppleTV = (1 -shl 8)
17+
Facebook = (1 -shl 9)
18+
Linux = (1 -shl 10)
19+
Mac = (1 -shl 11)
20+
Vuforia = (1 -shl 12)
21+
WebGL = (1 -shl 13)
22+
Windows_IL2CPP = (1 -shl 14)
23+
All = (-1)
24+
}
25+
526
class UnitySetupInstaller
627
{
728
[UnitySetupComponentType] $ComponentType
@@ -228,6 +249,7 @@ function Find-UnitySetupInstaller
228249
function Install-UnitySetupInstance
229250
{
230251
[CmdletBinding()]
252+
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Scope='Function')]
231253
param(
232254
[parameter(ValueFromPipeline=$true)]
233255
[UnitySetupInstaller[]] $Installers,
@@ -496,7 +518,7 @@ function Get-UnityProjectInstance
496518
#>
497519
function Start-UnityEditor
498520
{
499-
[CmdletBinding(DefaultParameterSetName="Context")]
521+
[CmdletBinding(SupportsShouldProcess, DefaultParameterSetName="Context")]
500522
param(
501523
[parameter(Mandatory=$false, ValueFromPipeline = $true, ParameterSetName='Projects')]
502524
[parameter(Mandatory=$true, ValueFromPipeline = $true, ParameterSetName='ProjectsLatest')]
@@ -665,7 +687,11 @@ function Start-UnityEditor
665687
$setProcessArgs['ArgumentList'] = $unityArgs
666688
}
667689

668-
Write-Verbose "Starting $editor $unityArgs"
690+
if(-not $PSCmdlet.ShouldProcess("$editor $unityArgs", "Start-Process"))
691+
{
692+
continue
693+
}
694+
669695
$process = Start-Process @setProcessArgs
670696
if( $Wait )
671697
{

UnitySetup/UnitySetupInit.ps1

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)