mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-21 06:30:20 -06:00
Merge topic 'astgrep-rm-cmdbg-usage'
43fbd92991 Utilities/ast-grep: add rules to remove `CM_DBG` usage
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10839
This commit is contained in:
@@ -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>':
|
||||
fixed: ''
|
||||
labels:
|
||||
- source: '#include <cmDebugTools.h>'
|
||||
style: primary
|
||||
start: 0
|
||||
end: 25
|
||||
@@ -0,0 +1,30 @@
|
||||
id: rm-cmdbg-macros
|
||||
snapshots:
|
||||
CM_DBG(arg);:
|
||||
fixed: arg;
|
||||
labels:
|
||||
- source: CM_DBG(arg)
|
||||
style: primary
|
||||
start: 0
|
||||
end: 11
|
||||
a = CM_DBG(arg);:
|
||||
fixed: a = arg;
|
||||
labels:
|
||||
- source: CM_DBG(arg)
|
||||
style: primary
|
||||
start: 4
|
||||
end: 15
|
||||
b = a + CM_DBG(arg);:
|
||||
fixed: b = a + arg;
|
||||
labels:
|
||||
- source: CM_DBG(arg)
|
||||
style: primary
|
||||
start: 8
|
||||
end: 19
|
||||
f(CM_DBG(arg));:
|
||||
fixed: f(arg);
|
||||
labels:
|
||||
- source: CM_DBG(arg)
|
||||
style: primary
|
||||
start: 2
|
||||
end: 13
|
||||
8
Utilities/ast-grep/rule-tests/rm-cmdbg-includes.yml
Normal file
8
Utilities/ast-grep/rule-tests/rm-cmdbg-includes.yml
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
id: rm-cmdbg-includes
|
||||
valid:
|
||||
- '#include "NotcmDebugTools.h"'
|
||||
- '#include <NotcmDebugTools.h>'
|
||||
invalid:
|
||||
- '#include "cmDebugTools.h"'
|
||||
- '#include <cmDebugTools.h>'
|
||||
10
Utilities/ast-grep/rule-tests/rm-cmdbg-macros.yml
Normal file
10
Utilities/ast-grep/rule-tests/rm-cmdbg-macros.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
id: rm-cmdbg-macros
|
||||
valid:
|
||||
- CM_DBG;
|
||||
- macro(expr);
|
||||
invalid:
|
||||
- CM_DBG(arg);
|
||||
- f(CM_DBG(arg));
|
||||
- b = a + CM_DBG(arg);
|
||||
- a = CM_DBG(arg);
|
||||
13
Utilities/ast-grep/rules/rm-cmdbg-includes.yml
Normal file
13
Utilities/ast-grep/rules/rm-cmdbg-includes.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
id: rm-cmdbg-includes
|
||||
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: ''
|
||||
12
Utilities/ast-grep/rules/rm-cmdbg-macros.yml
Normal file
12
Utilities/ast-grep/rules/rm-cmdbg-macros.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
id: rm-cmdbg-macros
|
||||
language: Cpp
|
||||
severity: 'off'
|
||||
message: "Remove `CM_DBG` usage before submission"
|
||||
ignores:
|
||||
# Unit tests for the header.
|
||||
- Tests/CMakeLib/testDebug.cxx
|
||||
rule:
|
||||
pattern: CM_DBG($EXPR)
|
||||
kind: call_expression
|
||||
fix: $EXPR
|
||||
Reference in New Issue
Block a user