You can look at this example. That's my commit. https://github.com/cocos2d/cocos2d-x/pull/19928
This is how I disabled clang-tidy checks on two directories with regular expressions.
'^((?!/cocos2d-x/external/|/cocos/scripting/).)*$'
It disables clang-tidy checks on external
directory and cocos/scripting
directory.
I create a python script to test whether the regular expression is working as intended.
#!/usr/bin/env python
import re
files = [
"/home/john/cocos2d-x/external/openssl/include/linux/openssl/bio.h",
"/home/john/cocos2d-x/external/tiff/include/linux/tiff.h",
"/home/john/git/cocos/cocos2d-x/cocos/scripting/lua-bindings/auto/lua_cocos2dx_3d_auto.cpp"
"/home/john/cocos2d-x/external/json/stringbuffer.h",
"/home/john/cocos2d-x/cocos/base/ccUtils.h",
"/home/john/git/cocos/cocos2d-x/cocos/scripting/js-bindings/precheader.cpp",
"/home/john/cocos2d-x/cocos/physics/CCPhysicsBody.cpp",
"/home/john/cocos2d-x/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.cpp",
"/home/john/cocos2d-x/templates/cpp-template-default/Classes/AppDelegate.cpp",
"/home/john/git/cocos/cocos2d-x/cocos/scripting/js-bindings/proj.android/CMakeLists.txt",
]
pattern = '^((?!/cocos2d-x/external/|/cocos/scripting/).)*$'
for file in files:
m = re.search(pattern, file)
if m:
print m.group(0)
Running this python file and the output is
/home/john/cocos2d-x/cocos/base/ccUtils.h
/home/john/cocos2d-x/cocos/physics/CCPhysicsBody.cpp
/home/john/cocos2d-x/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.cpp
/home/john/cocos2d-x/templates/cpp-template-default/Classes/AppDelegate.cpp
You can modify the regular expression and python test script to see if it works.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…