Skip to content

Commit a984b44

Browse files
authored
format
1 parent f633147 commit a984b44

File tree

1 file changed

+21
-31
lines changed

1 file changed

+21
-31
lines changed

vscode-extension/PSA_custom_Rules/BreakingChange/geneBreakingChange.ps1

+21-31
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,49 @@
11
#generate the json includes breaking change information
22

3-
#install-module azpreview
4-
5-
class breakingchangeResult{
3+
class breakingchangeResult {
64
[System.String] $Name
75
[System.String] $TypeBreakingChange
86
}
97

10-
class breakingchangeParaFunc{
8+
class breakingchangeParaFunc {
119
[System.String] $Name
1210
[System.String] $TypeBreakingChange
1311
[System.String] $FuncName
1412
}
1513

16-
class breakingchangeParaCmdlet{
14+
class breakingchangeParaCmdlet {
1715
[System.String] $Name
1816
[System.String] $TypeBreakingChange
1917
[System.String] $CmdletName
2018
}
2119

22-
$results = @{
23-
}
20+
$results = @{}
2421

2522
$results["updateTime"] = Get-Date
2623
$results["func"] = @()
2724
$results["cmdlet"] = @()
2825
$results["para_func"] = @()
2926
$results["para_cmdlet"] = @()
3027

31-
$results["updateTime"] = $results["updateTime"].ToString()
28+
$results["updateTime"] = $results["updateTime"].ToString()
3229

33-
$az_modules = Get-Module az.* -ListAvailable | Where-object {$_.Name -ne "Az.Tools.Migration"}
30+
$az_modules = Get-Module az.* -ListAvailable | Where-object { $_.Name -ne "Az.Tools.Migration" }
3431

35-
for ([int]$i = 0; $i -lt $az_modules.Count; $i++){
32+
for ([int]$i = 0; $i -lt $az_modules.Count; $i++) {
3633

37-
3834
import-module $az_modules[$i].name
3935
$module = get-module $az_modules[$i].name
4036

4137
$exportedFunctions = $module.ExportedFunctions
4238
$exportedCmdlets = $module.ExportedCmdlets
4339

44-
45-
foreach ($key in $exportedFunctions.Keys){
40+
foreach ($key in $exportedFunctions.Keys) {
4641
$func = $exportedFunctions[$key]
47-
42+
4843
#attributes of functions
49-
foreach ($Attribute in $func.ScriptBlock.Attributes){
50-
51-
if ($Attribute.TypeId.BaseType.Name -eq "GenericBreakingChangeAttribute" -or $Attribute.TypeId.Name -eq "GenericBreakingChangeAttribute"){
44+
foreach ($Attribute in $func.ScriptBlock.Attributes) {
45+
46+
if ($Attribute.TypeId.BaseType.Name -eq "GenericBreakingChangeAttribute" -or $Attribute.TypeId.Name -eq "GenericBreakingChangeAttribute") {
5247
#$Attribute.TypeId.Name
5348
$result = New-Object -TypeName breakingchangeResult
5449
$result.Name = $func.name
@@ -58,11 +53,11 @@ for ([int]$i = 0; $i -lt $az_modules.Count; $i++){
5853
}
5954

6055
#attributes of parameters in function
61-
foreach ($parameter_key in $func.Parameters.keys){
56+
foreach ($parameter_key in $func.Parameters.keys) {
6257
$parameter = $func.Parameters[$parameter_key]
63-
for ([int]$k = 0; $k -lt $parameter.Attributes.Count; $k++){
58+
for ([int]$k = 0; $k -lt $parameter.Attributes.Count; $k++) {
6459
$Attribute = $parameter.Attributes[$k]
65-
if ($Attribute.TypeId.BaseType.Name -eq "GenericBreakingChangeAttribute" -or $Attribute.TypeId.Name -eq "GenericBreakingChangeAttribute"){
60+
if ($Attribute.TypeId.BaseType.Name -eq "GenericBreakingChangeAttribute" -or $Attribute.TypeId.Name -eq "GenericBreakingChangeAttribute") {
6661
#$Attribute.TypeId.Name
6762
$result = New-Object -TypeName breakingchangeParaFunc
6863
$result.Name = $parameter_key
@@ -74,12 +69,12 @@ for ([int]$i = 0; $i -lt $az_modules.Count; $i++){
7469
}
7570
}
7671

77-
foreach ($key in $exportedCmdlets.Keys){
72+
foreach ($key in $exportedCmdlets.Keys) {
7873
$Cmdlet = $exportedCmdlets[$key]
7974

8075
#attributes of cmdlets
81-
foreach ($Attribute in $Cmdlet.ImplementingType.CustomAttributes){
82-
if ($Attribute.AttributeType.BaseType.Name -eq "GenericBreakingChangeAttribute" -or $Attribute.AttributeType.Name -eq "GenericBreakingChangeAttribute"){
76+
foreach ($Attribute in $Cmdlet.ImplementingType.CustomAttributes) {
77+
if ($Attribute.AttributeType.BaseType.Name -eq "GenericBreakingChangeAttribute" -or $Attribute.AttributeType.Name -eq "GenericBreakingChangeAttribute") {
8378
#$Attribute.AttributeType.Name
8479
$result = New-Object -TypeName breakingchangeResult
8580
$result.Name = $Cmdlet.Name
@@ -89,11 +84,11 @@ for ([int]$i = 0; $i -lt $az_modules.Count; $i++){
8984
}
9085

9186
#attributes of parameters in cmdlet
92-
foreach ($parameter_key in $Cmdlet.Parameters.keys){
87+
foreach ($parameter_key in $Cmdlet.Parameters.keys) {
9388
$parameter = $Cmdlet.Parameters[$parameter_key]
94-
for ([int]$k = 0; $k -lt $parameter.Attributes.Count; $k++){
89+
for ([int]$k = 0; $k -lt $parameter.Attributes.Count; $k++) {
9590
$Attribute = $parameter.Attributes[$k]
96-
if ($Attribute.TypeId.BaseType.Name -eq "GenericBreakingChangeAttribute" -or $Attribute.TypeId.Name -eq "GenericBreakingChangeAttribute"){
91+
if ($Attribute.TypeId.BaseType.Name -eq "GenericBreakingChangeAttribute" -or $Attribute.TypeId.Name -eq "GenericBreakingChangeAttribute") {
9792
# $Attribute.TypeId.Name
9893
$result = New-Object -TypeName breakingchangeParaCmdlet
9994
$result.Name = $parameter_key
@@ -103,12 +98,7 @@ for ([int]$i = 0; $i -lt $az_modules.Count; $i++){
10398
}
10499
}
105100
}
106-
107-
108101
}
109-
110-
111-
112102
}
113103
$json = $results | ConvertTo-Json
114104
$json > BreakingchangeSpec.json

0 commit comments

Comments
 (0)