summaryrefslogtreecommitdiffstats
path: root/src/pmdk/utils/CSTYLE.ps1
diff options
context:
space:
mode:
Diffstat (limited to 'src/pmdk/utils/CSTYLE.ps1')
-rw-r--r--src/pmdk/utils/CSTYLE.ps137
1 files changed, 37 insertions, 0 deletions
diff --git a/src/pmdk/utils/CSTYLE.ps1 b/src/pmdk/utils/CSTYLE.ps1
new file mode 100644
index 000000000..42b22b34c
--- /dev/null
+++ b/src/pmdk/utils/CSTYLE.ps1
@@ -0,0 +1,37 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2016-2017, Intel Corporation
+#
+# CSTYLE.ps1 -- script to check coding style
+#
+# XXX - integrate with VS projects and execute for each build
+#
+
+$scriptdir = Split-Path -Parent $PSCommandPath
+$rootdir = $scriptdir + "\.."
+$cstyle = $rootdir + "\utils\cstyle"
+$checkdir = $rootdir
+
+# XXX - *.cpp/*.hpp files not supported yet
+$include = @( "*.c", "*.h" )
+
+If ( Get-Command -Name perl -ErrorAction SilentlyContinue ) {
+ Get-ChildItem -Path $checkdir -Recurse -Include $include | `
+ Where-Object { $_.FullName -notlike "*jemalloc*" } | `
+ ForEach-Object {
+ $IGNORE = $_.DirectoryName + "\.cstyleignore"
+ if(Test-Path $IGNORE) {
+ if((Select-String $_.Name $IGNORE)) {
+ return
+ }
+ }
+ $_
+ } | ForEach-Object {
+ Write-Output $_.FullName
+ & perl $cstyle $_.FullName
+ if ($LASTEXITCODE -ne 0) {
+ Exit $LASTEXITCODE
+ }
+ }
+} else {
+ Write-Output "Cannot execute cstyle - perl is missing"
+}