-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcheck_code.py
More file actions
37 lines (32 loc) · 998 Bytes
/
check_code.py
File metadata and controls
37 lines (32 loc) · 998 Bytes
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
import os
import glob
root_path = path = os.getcwd()
include_dir = os.path.join(root_path, "include")
src_dir = os.path.join(root_path, "src")
tools_dir = os.path.join(root_path, "tools")
check_dirs = [include_dir, src_dir, tools_dir]
cpp_files = []
h_files = []
for root in check_dirs:
cpp_files += glob.glob(root + "/**/*.cpp", recursive=True)
h_files += glob.glob(root + "/**/*.h", recursive=True)
def cpplint():
cpplint_filters = [
"-runtime/references",
"-build/namespaces",
"-build/include",
"-build/c++11"
# "-whitespace/comments",
# "-whitespace/indent",
]
command = "cpplint "
if len(cpplint_filters) != 0:
command += "--filter="
for filter in cpplint_filters:
command += "{},".format(filter)
for file in cpp_files:
os.system("{} {}".format(command, file))
for file in h_files:
os.system("{} {}".format(command, file))
if __name__ == "__main__":
cpplint()