File tree 3 files changed +41
-256
lines changed
src/ResourceManagement/Compute
3 files changed +41
-256
lines changed Original file line number Diff line number Diff line change
1
+
2
+ function Check-SyncMethods ()
3
+ {
4
+ $retValue = $false
5
+
6
+ $TextPattern = [regex ]' \/\/\/ <summary>*([\r\n][ \t]+\/\/\/.*)+[\r\n][ \t]+public static.*\)[\r\n][ \t]+\{[\r\n].*\.GetAwaiter\(\)\.GetResult\(\);[\r\n][ \t]+\}[\r\n][\r\n][ \t]+'
7
+
8
+ Get-ChildItem - Recurse - Filter " *.cs" | Where-Object { $_.Attributes -ne " Directory" } | ForEach-Object {
9
+ $text = (Get-Content $_.FullName ) -join " `n "
10
+
11
+ if ($text -match $TextPattern ) {
12
+ Write-Host " [ERROR]: Found Sync Method in file: $ ( $_.FullName ) "
13
+ $retValue = $true
14
+ }
15
+ }
16
+ return $retValue ;
17
+ }
18
+
19
+ function Check-LicenseHeader ()
20
+ {
21
+ $retValue = $false
22
+ $licenseHeader = " // Copyright (c) Microsoft Corporation. All rights reserved."
23
+ $licenseHeaderAutoGen = " // <auto-generated> // Copyright (c) Microsoft Corporation. All rights reserved."
24
+
25
+ Get-ChildItem - Recurse - Filter " *.cs" | Where-Object { $_.Attributes -ne " Directory" } | ForEach-Object {
26
+ $text = (Get-Content $_.FullName - First 2 ) -join " "
27
+
28
+ if ((-Not $text.StartsWith ($licenseHeader )) -And (-Not $text.StartsWith ($licenseHeaderAutoGen ))) {
29
+ Write-Host " [ERROR]: File does not contain valid License Header: $ ( $_.FullName ) "
30
+ $retValue = $true
31
+ }
32
+ }
33
+ return $retValue ;
34
+ }
35
+
36
+ if (Check- SyncMethods | Check- LicenseHeader) {
37
+ exit (-1 )
38
+ }
39
+ exit (0 )
Original file line number Diff line number Diff line change 1
- using Azure . Tests ;
2
- // Copyright (c) Microsoft Corporation. All rights reserved.
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
3
2
// Licensed under the MIT License. See License.txt in the project root for license information.
4
3
4
+ using Azure . Tests ;
5
5
using Fluent . Tests . Common ;
6
6
using Microsoft . Azure . Management . ResourceManager . Fluent . Core ;
7
7
using Microsoft . Rest . Azure ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments