1 Star 2 Fork 3

Bytedance Inc./android-inline-hook

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
clang-format.py 1.40 KB
一键复制 编辑 原始数据 按行查看 历史
caikelun 提交于 3年前 . Fix some syntax issues.
#!/usr/bin/env python3
import os
import sys
import argparse
import subprocess
path_list = ['shadowhook/src/main/cpp/include',
'shadowhook/src/main/cpp',
'shadowhook/src/main/cpp/arch/arm',
'shadowhook/src/main/cpp/arch/arm64',
'shadowhook/src/main/cpp/common',
'app/src/main/cpp/unittest',
'app/src/main/cpp/hookee',
'app/src/main/cpp/hookee2',
'systest/src/main/cpp']
suffix_tuple = ('.h', '.c')
def main():
parser = argparse.ArgumentParser(description='clang-format runner')
parser.add_argument('-n', '--dry-run', action='store_true', help='If set, do not actually make the formatting changes')
options = parser.parse_args()
dry_run = '-n ' if options.dry_run else ''
for path in path_list:
for filename in sorted(os.listdir(path)):
f = os.path.join(path, filename)
if os.path.isfile(f) and f.endswith(suffix_tuple):
cmd = 'clang-format ' + dry_run + '--Werror -i -style=file ' + f
ret = subprocess.run(cmd, shell=True, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
retcode = ('' if ret.returncode == 0 else (' >>> return code: ' + str(ret.returncode)))
print('>>> ' + cmd + retcode)
print(ret.stdout, end='')
if __name__ == '__main__':
sys.exit(main())
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ByteDance/android-inline-hook.git
git@gitee.com:ByteDance/android-inline-hook.git
ByteDance
android-inline-hook
android-inline-hook
main

搜索帮助