Skip to content

Commit

Permalink
Check for prototype comments in separate job (#59862)
Browse files Browse the repository at this point in the history
  • Loading branch information
RikkiGibson authored Mar 8, 2022
1 parent 15bf05a commit ea11177
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 19 deletions.
10 changes: 10 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,16 @@ jobs:
publishLocation: Container
condition: succeeded()

- job: Correctness_TodoCheck
pool:
vmImage: ubuntu-20.04
timeoutInMinutes: 10
steps:
- template: eng/pipelines/checkout-unix-task.yml

- pwsh: eng/todo-check.ps1
displayName: Validate TODO/PROTOTYPE comments are not present

- job: Correctness_Rebuild
pool:
name: NetCore1ESPool-Public
Expand Down
19 changes: 0 additions & 19 deletions eng/test-build-correctness.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,6 @@ try {
New-ItemProperty -Path $key -Name 'DumpFolder' -PropertyType 'String' -Value $LogDir -Force
}

# Verify no PROTOTYPE marker left in main
if ($env:SYSTEM_PULLREQUEST_TARGETBRANCH -eq "main") {
Write-Host "Checking no PROTOTYPE markers in source"
$prototypes = Get-ChildItem -Path src, eng, scripts -Exclude *.dll,*.exe,*.pdb,*.xlf,test-build-correctness.ps1 -Recurse | Select-String -Pattern 'PROTOTYPE' -CaseSensitive -SimpleMatch
if ($prototypes) {
Write-Host "Found PROTOTYPE markers in source:"
Write-Host $prototypes
throw "PROTOTYPE markers disallowed in compiler source"
}
}

# Verify no TODO2 marker left
$prototypes = Get-ChildItem -Path src, eng, scripts -Exclude *.dll,*.exe,*.pdb,*.xlf,test-build-correctness.ps1 -Recurse | Select-String -Pattern 'TODO2' -CaseSensitive -SimpleMatch
if ($prototypes) {
Write-Host "Found TODO2 markers in source:"
Write-Host $prototypes
throw "TODO2 markers disallowed in compiler source"
}

Write-Host "Building Roslyn"
Exec-Block { & (Join-Path $PSScriptRoot "build.ps1") -restore -build -bootstrap -bootstrapConfiguration:Debug -ci:$ci -runAnalyzers:$true -configuration:$configuration -pack -binaryLog -useGlobalNuGetCache:$false -warnAsError:$true -properties "/p:RoslynEnforceCodeStyle=true"}

Expand Down
25 changes: 25 additions & 0 deletions eng/todo-check.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<#
Checks that TODO and PROTOTYPE comments are not present.
#>

# Verify no PROTOTYPE marker left in main
Set-StrictMode -version 2.0
$ErrorActionPreference="Stop"
if ($env:SYSTEM_PULLREQUEST_TARGETBRANCH -eq "main") {
Write-Host "Checking no PROTOTYPE markers in source"
$prototypes = Get-ChildItem -Path src, eng, scripts -Exclude *.dll,*.exe,*.pdb,*.xlf,todo-check.ps1 -Recurse | Select-String -Pattern 'PROTOTYPE' -CaseSensitive -SimpleMatch
if ($prototypes) {
Write-Host "Found PROTOTYPE markers in source:"
Write-Host $prototypes
throw "PROTOTYPE markers disallowed in compiler source"
}
}

# Verify no TODO2 marker left
$prototypes = Get-ChildItem -Path src, eng, scripts -Exclude *.dll,*.exe,*.pdb,*.xlf,todo-check.ps1 -Recurse | Select-String -Pattern 'TODO2' -CaseSensitive -SimpleMatch
if ($prototypes) {
Write-Host "Found TODO2 markers in source:"
Write-Host $prototypes
throw "TODO2 markers disallowed in compiler source"
}

0 comments on commit ea11177

Please sign in to comment.