-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfmt
executable file
·41 lines (35 loc) · 863 Bytes
/
fmt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python3
from glob import glob
import subprocess
import click
from ci import git_ls_py_files
@click.command()
@click.option("--check", is_flag=True)
def main(check):
if check:
black_args = ["--check"]
clang_format_args = ["--dry-run", "-Werror"]
else:
black_args = []
clang_format_args = ["-i"]
subprocess.check_call(["black", *git_ls_py_files(), *black_args])
memtrace_ext_sources = [
*glob("memtrace_ext/*.cc"),
*glob("memtrace_ext/*.h"),
]
subprocess.check_call(
[
"clang-format",
*memtrace_ext_sources,
*clang_format_args,
]
)
subprocess.check_call(
[
"cpplint",
"--root=memtrace_ext",
*memtrace_ext_sources,
]
)
if __name__ == "__main__":
main()