43fbd92991 Utilities/ast-grep: add rules to remove `CM_DBG` usage Acked-by: Kitware Robot <[email protected]> Merge-request: !10839
@@ -0,0 +1,16 @@
+id: rm-cmdbg-includes
+snapshots:
+ '#include "cmDebugTools.h"':
+ fixed: ''
+ labels:
+ - source: '#include "cmDebugTools.h"'
+ style: primary
+ start: 0
+ end: 25
+ '#include <cmDebugTools.h>':
+ - source: '#include <cmDebugTools.h>'
@@ -0,0 +1,30 @@
+id: rm-cmdbg-macros
+ CM_DBG(arg);:
+ fixed: arg;
+ - source: CM_DBG(arg)
+ end: 11
+ a = CM_DBG(arg);:
+ fixed: a = arg;
+ start: 4
+ end: 15
+ b = a + CM_DBG(arg);:
+ fixed: b = a + arg;
+ start: 8
+ end: 19
+ f(CM_DBG(arg));:
+ fixed: f(arg);
+ start: 2
+ end: 13
@@ -0,0 +1,8 @@
+---
+valid:
+ - '#include "NotcmDebugTools.h"'
+ - '#include <NotcmDebugTools.h>'
+invalid:
+ - '#include "cmDebugTools.h"'
+ - '#include <cmDebugTools.h>'
@@ -0,0 +1,10 @@
+ - CM_DBG;
+ - macro(expr);
+ - CM_DBG(arg);
+ - f(CM_DBG(arg));
+ - b = a + CM_DBG(arg);
+ - a = CM_DBG(arg);
@@ -0,0 +1,13 @@
+language: Cpp
+severity: 'off'
+message: "Remove `cmDebugTools.h` includes before submission"
+ignores:
+ # Unit tests for the header.
+ - Tests/CMakeLib/testDebug.cxx
+rule:
+ any:
+ - pattern: '#include "cmDebugTools.h"'
+ - pattern: '#include <cmDebugTools.h>'
+fix: ''
@@ -0,0 +1,12 @@
+message: "Remove `CM_DBG` usage before submission"
+ pattern: CM_DBG($EXPR)
+ kind: call_expression
+fix: $EXPR