diff --git a/build/pipelines/templates/build-console-audit-job.yml b/build/pipelines/templates/build-console-audit-job.yml index b5bb0699c..1d79b1e54 100644 --- a/build/pipelines/templates/build-console-audit-job.yml +++ b/build/pipelines/templates/build-console-audit-job.yml @@ -41,6 +41,12 @@ jobs: nugetConfigPath: build/config/NuGet.config restoreDirectory: '$(Build.SourcesDirectory)/packages' + - task: PowerShell@2 + displayName: 'Code Formattting Check' + inputs: + targetType: filePath + filePath: '.\build\scripts\Invoke-FormattingCheck.ps1' + - task: VSBuild@1 displayName: 'Build solution **\OpenConsole.sln' inputs: diff --git a/build/scripts/Invoke-FormattingCheck.ps1 b/build/scripts/Invoke-FormattingCheck.ps1 new file mode 100644 index 000000000..8cb8e5f8a --- /dev/null +++ b/build/scripts/Invoke-FormattingCheck.ps1 @@ -0,0 +1,14 @@ + +#.SYNOPSIS +# Checks for code formatting errors. Will throw exception if any are found. +function Invoke-CheckBadCodeFormatting() { + Import-Module ./tools/OpenConsole.psm1 + Invoke-CodeFormat + # returns a non-zero exit code if there are any diffs in the tracked files in the repo + git diff-index --quiet HEAD -- + if ($lastExitCode -eq 1) { + throw "code formatting bad, run Invoke-CodeFormat on branch" + } +} + +Invoke-CheckBadCodeFormatting diff --git a/dep/llvm/clang-format.exe b/dep/llvm/clang-format.exe new file mode 100644 index 000000000..efed82cc0 Binary files /dev/null and b/dep/llvm/clang-format.exe differ